SL-19478 Fix for assert when applying specular map.

meow-7.2.2
Dave Parks 2023-03-23 16:31:49 -05:00
parent 82125e8fba
commit 9b96bf168e
1 changed files with 10 additions and 0 deletions

View File

@ -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));