SL-18788 Fix for legacy shiny not working until after restart when reflections probes are disabled.

meow-7.2.2
Dave Parks 2022-12-06 10:18:46 -06:00
parent c489481ec5
commit 03da83f235
5 changed files with 38 additions and 37 deletions

View File

@ -299,7 +299,7 @@ void LLDrawPoolBump::beginShiny()
void LLDrawPoolBump::bindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel)
{
LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
if( cube_map )
if( cube_map && !LLPipeline::sReflectionProbesEnabled )
{
if (shader )
{
@ -346,7 +346,7 @@ void LLDrawPoolBump::renderShiny()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY);
if( gSky.mVOSkyp->getCubeMap() )
if( gSky.mVOSkyp->getCubeMap() && !LLPipeline::sReflectionProbesEnabled )
{
LLGLEnable blend_enable(GL_BLEND);
if (mShaderLevel > 1)
@ -378,7 +378,7 @@ void LLDrawPoolBump::renderShiny()
void LLDrawPoolBump::unbindCubeMap(LLGLSLShader* shader, S32 shader_level, S32& diffuse_channel, S32& cube_channel)
{
LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
if( cube_map )
if( cube_map && !LLPipeline::sReflectionProbesEnabled)
{
if (shader_level > 1)
{
@ -446,7 +446,7 @@ void LLDrawPoolBump::beginFullbrightShiny()
LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
if (cube_map)
if (cube_map && !LLPipeline::sReflectionProbesEnabled)
{
// Make sure that texture coord generation happens for tex unit 1, as that's the one we use for
// the cube map in the one pass shiny shaders
@ -534,7 +534,7 @@ void LLDrawPoolBump::endFullbrightShiny()
LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_RENDER_SHINY);
LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
if( cube_map )
if( cube_map && !LLPipeline::sReflectionProbesEnabled )
{
cube_map->disable();
if (shader->mFeatures.hasReflectionProbes)

View File

@ -300,7 +300,7 @@ void LLDrawPoolWater::render(S32 pass)
stop_glerror();
if (gSky.mVOSkyp->getCubeMap())
if (gSky.mVOSkyp->getCubeMap() && !LLPipeline::sReflectionProbesEnabled)
{
gSky.mVOSkyp->getCubeMap()->enable(0);
gSky.mVOSkyp->getCubeMap()->bind();

View File

@ -525,11 +525,6 @@ void LLVOSky::calc()
void LLVOSky::initCubeMap()
{
if (LLPipeline::sReflectionProbesEnabled)
{
return;
}
std::vector<LLPointer<LLImageRaw> > images;
for (S32 side = 0; side < NUM_CUBEMAP_FACES; side++)
{
@ -697,7 +692,7 @@ bool LLVOSky::updateSky()
LLHeavenBody::setInterpVal( mInterpVal );
updateDirections(psky);
if (!mCubeMap)
if (!mCubeMap || LLPipeline::sReflectionProbesEnabled)
{
mCubeMapUpdateStage = NUM_CUBEMAP_FACES;
mForceUpdate = FALSE;

View File

@ -8489,24 +8489,27 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
stop_glerror();
channel = shader.enableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
if (channel > -1)
{
LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
if (cube_map)
{
cube_map->enable(channel);
cube_map->bind();
}
if (!LLPipeline::sReflectionProbesEnabled)
{
channel = shader.enableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
if (channel > -1)
{
LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
if (cube_map)
{
cube_map->enable(channel);
cube_map->bind();
}
F32* m = gGLModelView;
F32* m = gGLModelView;
F32 mat[] = { m[0], m[1], m[2],
m[4], m[5], m[6],
m[8], m[9], m[10] };
F32 mat[] = { m[0], m[1], m[2],
m[4], m[5], m[6],
m[8], m[9], m[10] };
shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, TRUE, mat);
}
shader.uniformMatrix3fv(LLShaderMgr::DEFERRED_ENV_MAT, 1, TRUE, mat);
}
}
bindReflectionProbes(shader);
@ -9346,15 +9349,18 @@ void LLPipeline::unbindDeferredShader(LLGLSLShader &shader)
shader.disableTexture(LLShaderMgr::DEFERRED_NOISE);
shader.disableTexture(LLShaderMgr::DEFERRED_LIGHTFUNC);
S32 channel = shader.disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
if (channel > -1)
{
LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
if (cube_map)
{
cube_map->disable();
}
}
if (!LLPipeline::sReflectionProbesEnabled)
{
S32 channel = shader.disableTexture(LLShaderMgr::ENVIRONMENT_MAP, LLTexUnit::TT_CUBE_MAP);
if (channel > -1)
{
LLCubeMap* cube_map = gSky.mVOSkyp ? gSky.mVOSkyp->getCubeMap() : NULL;
if (cube_map)
{
cube_map->disable();
}
}
}
unbindReflectionProbes(shader);

View File

@ -652,7 +652,7 @@
control_name="RenderReflectionsEnabled"
height="16"
initial_value="true"
label="Reflections (requires restart)"
label="Reflections"
layout="topleft"
left="420"
name="ReflectionsEnabled"