diff options
author | Graham Linden <graham@lindenlab.com> | 2018-06-01 15:34:21 +0100 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2018-06-01 15:34:21 +0100 |
commit | 37e8fd20c3823482f3a15b4bfd544f7847070db8 (patch) | |
tree | b31e3a1ef86431cda7703621f779b38a98c14a3e /indra/llrender/llglslshader.cpp | |
parent | 64302d3000b69b31e72eb6a3bd8a981c80cb88de (diff) | |
parent | bd84cbfa11fbe2b3aa5ceba5978841310488b8e4 (diff) |
Merge to 5.1.6
Diffstat (limited to 'indra/llrender/llglslshader.cpp')
-rw-r--r-- | indra/llrender/llglslshader.cpp | 54 |
1 files changed, 31 insertions, 23 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 9bdbc9c80a..b027a24017 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -755,24 +755,25 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms) , even if the "diffuseMap" will be appear and use first in shader code. As example where this situation appear see: "Deferred Material Shader 28/29/30/31" - And tickets: MAINT-4165, MAINT-4839, MAINT-3568 + And tickets: MAINT-4165, MAINT-4839, MAINT-3568, MAINT-6437 */ S32 diffuseMap = glGetUniformLocationARB(mProgramObject, "diffuseMap"); + S32 specularMap = glGetUniformLocationARB(mProgramObject, "specularMap"); S32 bumpMap = glGetUniformLocationARB(mProgramObject, "bumpMap"); S32 environmentMap = glGetUniformLocationARB(mProgramObject, "environmentMap"); std::set<S32> skip_index; - if (-1 != diffuseMap && (-1 != bumpMap || -1 != environmentMap)) + if (-1 != diffuseMap && (-1 != specularMap || -1 != bumpMap || -1 != environmentMap)) { GLenum type; GLsizei length; GLint size = -1; char name[1024]; - diffuseMap = bumpMap = environmentMap = -1; + diffuseMap = specularMap = bumpMap = environmentMap = -1; for (S32 i = 0; i < activeCount; i++) { @@ -786,6 +787,18 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms) continue; } + if (-1 == specularMap && std::string(name) == "specularMap") + { + specularMap = i; + continue; + } + + if (-1 == specularMap && std::string(name) == "specularMap") + { + specularMap = i; + continue; + } + if (-1 == bumpMap && std::string(name) == "bumpMap") { bumpMap = i; @@ -799,34 +812,29 @@ BOOL LLGLSLShader::mapUniforms(const vector<LLStaticHashedString> * uniforms) } } + bool specularDiff = specularMap < diffuseMap && -1 != specularMap; bool bumpLessDiff = bumpMap < diffuseMap && -1 != bumpMap; bool envLessDiff = environmentMap < diffuseMap && -1 != environmentMap; - if (bumpLessDiff && envLessDiff) + if (specularDiff || bumpLessDiff || envLessDiff) { mapUniform(diffuseMap, uniforms); - mapUniform(bumpMap, uniforms); - mapUniform(environmentMap, uniforms); - skip_index.insert(diffuseMap); - skip_index.insert(bumpMap); - skip_index.insert(environmentMap); - } - else if (bumpLessDiff) - { - mapUniform(diffuseMap, uniforms); - mapUniform(bumpMap, uniforms); - skip_index.insert(diffuseMap); - skip_index.insert(bumpMap); - } - else if (envLessDiff) - { - mapUniform(diffuseMap, uniforms); - mapUniform(environmentMap, uniforms); + if (-1 != specularMap) { + mapUniform(specularMap, uniforms); + skip_index.insert(specularMap); + } - skip_index.insert(diffuseMap); - skip_index.insert(environmentMap); + if (-1 != bumpMap) { + mapUniform(bumpMap, uniforms); + skip_index.insert(bumpMap); + } + + if (-1 != environmentMap) { + mapUniform(environmentMap, uniforms); + skip_index.insert(environmentMap); + } } } |