summaryrefslogtreecommitdiff
path: root/indra/llrender/llglslshader.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2025-05-28 22:48:17 +0300
committerGitHub <noreply@github.com>2025-05-28 22:48:17 +0300
commit91adb11d10fe0c18790be64fa7a6ce5b0bbdcb09 (patch)
tree3e5294e3b8ff07778e6134ed9dd41458386032ac /indra/llrender/llglslshader.cpp
parentb9ab6c3644da02bed6941dc8df433fb1c626f8c7 (diff)
parentb08ba3fa7bc9e6309891e510fbfb5c4e2b5c922e (diff)
Merge pull request #4183 from secondlife/marchcat/2505-merge
Marchcat/2505 merge
Diffstat (limited to 'indra/llrender/llglslshader.cpp')
-rw-r--r--indra/llrender/llglslshader.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index b3f32fdc83..3735a99109 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -1076,8 +1076,8 @@ void LLGLSLShader::bind()
void LLGLSLShader::bind(U8 variant)
{
- llassert(mGLTFVariants.size() == LLGLSLShader::NUM_GLTF_VARIANTS);
- llassert(variant < LLGLSLShader::NUM_GLTF_VARIANTS);
+ llassert_always(mGLTFVariants.size() == LLGLSLShader::NUM_GLTF_VARIANTS);
+ llassert_always(variant < LLGLSLShader::NUM_GLTF_VARIANTS);
mGLTFVariants[variant].bind();
}
@@ -1085,7 +1085,7 @@ void LLGLSLShader::bind(bool rigged)
{
if (rigged)
{
- llassert(mRiggedVariant);
+ llassert_always(mRiggedVariant);
mRiggedVariant->bind();
}
else
@@ -1247,23 +1247,40 @@ S32 LLGLSLShader::disableTexture(S32 uniform, LLTexUnit::eTextureType mode)
llassert(false);
return -1;
}
+
S32 index = mTexture[uniform];
- if (index != -1 && gGL.getTexUnit(index)->getCurrType() != LLTexUnit::TT_NONE)
+ if (index < 0)
+ {
+ // Invalid texture index - nothing to disable
+ return index;
+ }
+
+ LLTexUnit* tex_unit = gGL.getTexUnit(index);
+ if (!tex_unit)
{
- if (gDebugGL && gGL.getTexUnit(index)->getCurrType() != mode)
+ // Invalid texture unit
+ LL_WARNS_ONCE("Shader") << "Invalid texture unit at index: " << index << LL_ENDL;
+ return index;
+ }
+
+ LLTexUnit::eTextureType curr_type = tex_unit->getCurrType();
+ if (curr_type != LLTexUnit::TT_NONE)
+ {
+ if (gDebugGL && curr_type != mode)
{
if (gDebugSession)
{
- gFailLog << "Texture channel " << index << " texture type corrupted." << std::endl;
+ gFailLog << "Texture channel " << index << " texture type corrupted. Expected: " << mode << ", Found: " << curr_type << std::endl;
ll_fail("LLGLSLShader::disableTexture failed");
}
else
{
- LL_ERRS() << "Texture channel " << index << " texture type corrupted." << LL_ENDL;
+ LL_ERRS() << "Texture channel " << index << " texture type corrupted. Expected: " << mode << ", Found: " << curr_type << LL_ENDL;
}
}
- gGL.getTexUnit(index)->disable();
+ tex_unit->disable();
}
+
return index;
}