diff options
author | AndreyL ProductEngine <alihatskiy@productengine.com> | 2018-01-17 03:46:29 +0200 |
---|---|---|
committer | AndreyL ProductEngine <alihatskiy@productengine.com> | 2018-01-17 03:46:29 +0200 |
commit | 99308bb8a828c991be06c8620f02d6618328be15 (patch) | |
tree | 42d44f6a2eedaa73d60d733a61f0b6ba56d4361a /indra/llrender/llglslshader.cpp | |
parent | 7acbd8ed8d73c507675d45360df07d232c431a8b (diff) | |
parent | df376c029936da11b3e1dda54f9c327de50440a8 (diff) |
Merged in andreyl_productengine/viewer64-marchcat (DRTVWR-431 fixes)
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 970502f2d6..97557267cf 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -744,24 +744,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++) { @@ -775,6 +776,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; @@ -788,34 +801,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); + } } } |