diff options
author | Dave Parks <davep@lindenlab.com> | 2021-10-21 21:19:48 +0000 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2021-10-21 21:19:48 +0000 |
commit | e774bffb28a71730792931aeb1ed6a46d3cfe67b (patch) | |
tree | d82248f9fc0678fb5e6e3c39f5d0011707b0a86c /indra/llrender/llrender.cpp | |
parent | 6ecf8f2c01dc90c26a8a0ccbd11abc2241debfa9 (diff) |
SL-16202 Fix for textures appearing black or flashing white due to optimization bugs.
Diffstat (limited to 'indra/llrender/llrender.cpp')
-rw-r--r-- | indra/llrender/llrender.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 669a09d3ce..aad04beea2 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -236,6 +236,10 @@ void LLTexUnit::bindFast(LLTexture* texture) glActiveTextureARB(GL_TEXTURE0_ARB + mIndex); gGL.mCurrTextureUnitIndex = mIndex; mCurrTexture = gl_tex->getTexName(); + if (!mCurrTexture) + { + mCurrTexture = LLImageGL::sDefaultGLTexture->getTexName(); + } glBindTexture(sGLTextureType[gl_tex->getTarget()], mCurrTexture); mHasMipMaps = gl_tex->mHasMipMaps; } @@ -306,18 +310,20 @@ bool LLTexUnit::bind(LLTexture* texture, bool for_rendering, bool forceBind) return true; } -bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind) +bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind, S32 usename) { stop_glerror(); if (mIndex < 0) return false; + U32 texname = usename ? usename : texture->getTexName(); + if(!texture) { LL_DEBUGS() << "NULL LLTexUnit::bind texture" << LL_ENDL; return false; } - if(!texture->getTexName()) + if(!texname) { if(LLImageGL::sDefaultGLTexture && LLImageGL::sDefaultGLTexture->getTexName()) { @@ -327,7 +333,7 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind) return false ; } - if ((mCurrTexture != texture->getTexName()) || forceBind) + if ((mCurrTexture != texname) || forceBind) { gGL.flush(); stop_glerror(); @@ -335,7 +341,7 @@ bool LLTexUnit::bind(LLImageGL* texture, bool for_rendering, bool forceBind) stop_glerror(); enable(texture->getTarget()); stop_glerror(); - mCurrTexture = texture->getTexName(); + mCurrTexture = texname; glBindTexture(sGLTextureType[texture->getTarget()], mCurrTexture); stop_glerror(); texture->updateBindStats(texture->mTextureMemory); |