SH-2031 Fix for shadow render targets using inappropriate shader for occlusion culling resulting in objects popping in and out of the shadow map.

meow-7.2.2
Dave Parks 2011-07-18 12:22:54 -05:00
parent 190ff3c346
commit 2eaadf9024
1 changed files with 20 additions and 4 deletions

View File

@ -2147,9 +2147,18 @@ void LLPipeline::doOcclusion(LLCamera& camera)
LLGLDisable cull(GL_CULL_FACE);
if (canUseVertexShaders())
bool bind_shader = LLGLSLShader::sNoFixedFunction && LLGLSLShader::sCurBoundShader == 0;
if (bind_shader)
{
gOcclusionProgram.bind();
if (LLPipeline::sShadowRender)
{
gDeferredShadowProgram.bind();
}
else
{
gOcclusionProgram.bind();
}
}
for (LLCullResult::sg_list_t::iterator iter = sCull->beginOcclusionGroups(); iter != sCull->endOcclusionGroups(); ++iter)
@ -2159,9 +2168,16 @@ void LLPipeline::doOcclusion(LLCamera& camera)
group->clearOcclusionState(LLSpatialGroup::ACTIVE_OCCLUSION);
}
if (canUseVertexShaders())
if (bind_shader)
{
gOcclusionProgram.unbind();
if (LLPipeline::sShadowRender)
{
gDeferredShadowProgram.unbind();
}
else
{
gOcclusionProgram.unbind();
}
}
gGL.setColorMask(true, false);