diff options
author | Rider Linden <rider@lindenlab.com> | 2018-05-31 11:49:27 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-05-31 11:49:27 -0700 |
commit | bd84cbfa11fbe2b3aa5ceba5978841310488b8e4 (patch) | |
tree | cd4ddab644af5f7a560a4ee53db9d36033e8e0ad /indra/llrender/llglslshader.cpp | |
parent | 460d944b082ae73bbad3cf1d72a47ffa88970fb9 (diff) | |
parent | 40d4e8b2e6d25a625c7a5ef5dd3e94321d18ce82 (diff) |
Merge
Diffstat (limited to 'indra/llrender/llglslshader.cpp')
-rw-r--r-- | indra/llrender/llglslshader.cpp | 62 |
1 files changed, 39 insertions, 23 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index b09ec53bc0..37a62da17c 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -542,7 +542,11 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attri mAttribute.clear(); U32 numAttributes = (attributes == NULL) ? 0 : attributes->size(); +#if LL_RELEASE_WITH_DEBUG_INFO + mAttribute.resize(LLShaderMgr::instance()->mReservedAttribs.size() + numAttributes, { -1, NULL }); +#else mAttribute.resize(LLShaderMgr::instance()->mReservedAttribs.size() + numAttributes, -1); +#endif if (res) { //read back channel locations @@ -556,7 +560,11 @@ BOOL LLGLSLShader::mapAttributes(const std::vector<LLStaticHashedString> * attri S32 index = glGetAttribLocationARB(mProgramObject, (const GLcharARB *)name); if (index != -1) { +#if LL_RELEASE_WITH_DEBUG_INFO + mAttribute[i] = { index, name }; +#else mAttribute[i] = index; +#endif mAttributeMask |= 1 << i; LL_DEBUGS("ShaderLoading") << "Attribute " << name << " assigned to channel " << index << LL_ENDL; } @@ -752,24 +760,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++) { @@ -783,6 +792,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; @@ -796,34 +817,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); + } } } |