diff options
author | Dave Parks <davep@lindenlab.com> | 2022-05-04 16:07:50 +0000 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-05-04 16:07:50 +0000 |
commit | 93260cfeff2382dd1ffeecaef208d37bf21c2a01 (patch) | |
tree | a51461dd9f27c27931e2feb288920f7feff71480 /indra/llrender/llglslshader.cpp | |
parent | 82311e4b44a863078fb1f47d56e9543abaae210c (diff) |
SL-17283 LLReflectionMapManager prototype. Remove snapshot code related overhead from reflection map renders. Add parallax correction and support for multiple reflection maps.
Diffstat (limited to 'indra/llrender/llglslshader.cpp')
-rw-r--r-- | indra/llrender/llglslshader.cpp | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp index 3001375c60..a52dcd5aa1 100644 --- a/indra/llrender/llglslshader.cpp +++ b/indra/llrender/llglslshader.cpp @@ -738,7 +738,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<LLStaticHashedString> * { //found it mUniform[i] = location; - mTexture[i] = mapUniformTextureChannel(location, type); + mTexture[i] = mapUniformTextureChannel(location, type, size); return; } } @@ -752,7 +752,7 @@ void LLGLSLShader::mapUniform(GLint index, const vector<LLStaticHashedString> * { //found it mUniform[i+LLShaderMgr::instance()->mReservedUniforms.size()] = location; - mTexture[i+LLShaderMgr::instance()->mReservedUniforms.size()] = mapUniformTextureChannel(location, type); + mTexture[i+LLShaderMgr::instance()->mReservedUniforms.size()] = mapUniformTextureChannel(location, type, size); return; } } @@ -775,16 +775,37 @@ void LLGLSLShader::removePermutation(std::string name) mDefines[name].erase(); } -GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type) +GLint LLGLSLShader::mapUniformTextureChannel(GLint location, GLenum type, GLint size) { LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER; if ((type >= GL_SAMPLER_1D_ARB && type <= GL_SAMPLER_2D_RECT_SHADOW_ARB) || type == GL_SAMPLER_2D_MULTISAMPLE) { //this here is a texture - glUniform1iARB(location, mActiveTextureChannels); - LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL; - return mActiveTextureChannels++; + GLint ret = mActiveTextureChannels; + if (size == 1) + { + glUniform1iARB(location, mActiveTextureChannels); + LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " << mActiveTextureChannels << LL_ENDL; + mActiveTextureChannels++; + } + else + { + //is array of textures, make sequential after this texture + GLint channel[32]; // <=== only support up to 32 texture channels + llassert(size <= 32); + size = llmin(size, 32); + for (int i = 0; i < size; ++i) + { + channel[i] = mActiveTextureChannels++; + } + glUniform1ivARB(location, size, channel); + LL_DEBUGS("ShaderUniform") << "Assigned to texture channel " << + (mActiveTextureChannels-size) << " through " << (mActiveTextureChannels-1) << LL_ENDL; + } + + llassert(mActiveTextureChannels <= 32); // too many textures (probably) + return ret; } return -1; } |