summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-03-23 16:31:49 -0500
committerDave Parks <davep@lindenlab.com>2023-03-23 16:31:49 -0500
commit9b96bf168e15d49bfb6857b3370b9c843b150390 (patch)
tree4722b9777d338b1cef0ce02589948f3f3a867b08
parent82125e8fba67de32f43d4a1c2290f2eec6a1d5e2 (diff)
SL-19478 Fix for assert when applying specular map.
-rw-r--r--indra/newview/llvovolume.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 7be9394364..77849c668a 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -5473,6 +5473,7 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
llassert(type != LLRenderPass::PASS_BUMP || (info->mVertexBuffer->getTypeMask() & LLVertexBuffer::MAP_TANGENT) != 0);
llassert(type != LLRenderPass::PASS_NORMSPEC || info->mNormalMap.notNull());
+ llassert(type != LLRenderPass::PASS_SPECMAP || (info->mVertexBuffer->getTypeMask() & LLVertexBuffer::MAP_TEXCOORD2) != 0);
}
void LLVolumeGeometryManager::getGeometry(LLSpatialGroup* group)
@@ -6666,6 +6667,15 @@ U32 LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFace
}
U32 mask = mat->getShaderMask(alpha_mode);
+ U32 vb_mask = facep->getVertexBuffer()->getTypeMask();
+
+ // HACK - this should also never happen, but sometimes we get here and the material thinks it has a specmap now
+ // even though it didn't appear to have a specmap when the face was added to the list of faces
+ if ((mask & 0x4) && !(vb_mask & LLVertexBuffer::MAP_TEXCOORD2))
+ {
+ mask &= ~0x4;
+ }
+
llassert(mask < sizeof(pass)/sizeof(U32));
mask = llmin(mask, (U32)(sizeof(pass)/sizeof(U32)-1));