From 6164d465af3f71ff1295d0170fda22d2862c496c Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Wed, 15 Dec 2021 10:38:18 -0800 Subject: SL-16493: Fix non-fullbright partial alpha objects not being lit by sun broken in 511de439a3 --- indra/newview/lldrawpoolalpha.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 5eb5c6caad..3de9fda945 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -84,12 +84,21 @@ S32 LLDrawPoolAlpha::getNumPostDeferredPasses() } // set some common parameters on the given shader to prepare for alpha rendering -static void prepare_alpha_shader(LLGLSLShader* shader, bool textureGamma) +static void prepare_alpha_shader(LLGLSLShader* shader, bool textureGamma, bool deferredEnvironment) { static LLCachedControl displayGamma(gSavedSettings, "RenderDeferredDisplayGamma"); F32 gamma = displayGamma; - shader->bind(); + // Deferred shader needs environment uniforms set such as sun_dir, etc. ? + // i.e. shaders\class1\deferred\alphaF.glsl + if (deferredEnvironment) + { + gPipeline.bindDeferredShader( *shader ); + } + else + { + shader->bind(); + } shader->uniform1i(LLShaderMgr::NO_ATMO, (LLPipeline::sRenderingHUDs) ? 1 : 0); shader->uniform1f(LLShaderMgr::DISPLAY_GAMMA, (gamma > 0.1f) ? 1.0f / gamma : (1.0f / 2.2f)); @@ -109,7 +118,7 @@ static void prepare_alpha_shader(LLGLSLShader* shader, bool textureGamma) //also prepare rigged variant if (shader->mRiggedVariant && shader->mRiggedVariant != shader) { - prepare_alpha_shader(shader->mRiggedVariant, textureGamma); + prepare_alpha_shader(shader->mRiggedVariant, textureGamma, deferredEnvironment); } } @@ -121,15 +130,15 @@ void LLDrawPoolAlpha::renderPostDeferred(S32 pass) // first pass, regular forward alpha rendering { emissive_shader = (LLPipeline::sUnderWaterRender) ? &gObjectEmissiveWaterProgram : &gObjectEmissiveProgram; - prepare_alpha_shader(emissive_shader, true); + prepare_alpha_shader(emissive_shader, true, false); fullbright_shader = (LLPipeline::sImpostorRender) ? &gDeferredFullbrightProgram : (LLPipeline::sUnderWaterRender) ? &gDeferredFullbrightWaterProgram : &gDeferredFullbrightProgram; - prepare_alpha_shader(fullbright_shader, true); + prepare_alpha_shader(fullbright_shader, true, false); simple_shader = (LLPipeline::sImpostorRender) ? &gDeferredAlphaImpostorProgram : (LLPipeline::sUnderWaterRender) ? &gDeferredAlphaWaterProgram : &gDeferredAlphaProgram; - prepare_alpha_shader(simple_shader, false); + prepare_alpha_shader(simple_shader, false, true); //prime simple shader (loads shadow relevant uniforms) forwardRender(); } -- cgit v1.2.3 From 9ac89bca2cb8cf3bc55cc26113d400b7b3473335 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Wed, 15 Dec 2021 14:11:02 -0800 Subject: SL-16493: Add comment about using deferred shaders even though we are in a post deferred state (forward pass rendering for transparency) --- indra/newview/lldrawpoolalpha.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolalpha.cpp') diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 3de9fda945..ee1a640f2d 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -89,7 +89,9 @@ static void prepare_alpha_shader(LLGLSLShader* shader, bool textureGamma, bool d static LLCachedControl displayGamma(gSavedSettings, "RenderDeferredDisplayGamma"); F32 gamma = displayGamma; - // Deferred shader needs environment uniforms set such as sun_dir, etc. ? + // Does this deferred shader need environment uniforms set such as sun_dir, etc. ? + // NOTE: We don't actually need a gbuffer since we are doing forward rendering (for transparency) post deferred rendering + // TODO: bindDeferredShader() probably should have the updating of the environment uniforms factored out into updateShaderEnvironmentUniforms() // i.e. shaders\class1\deferred\alphaF.glsl if (deferredEnvironment) { -- cgit v1.2.3