From 1df7760d315430766bba44d4d4c64480b4a6138f Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 14 Sep 2018 21:52:52 +0100 Subject: SL-9632 add uniform and code to supress atmospherics in all shaders that could be used by HUDs Make sky and cloud shaders use common scaleSoftClip implementation in gammaF.glsl --- indra/newview/lldrawpoolsimple.cpp | 155 +++++++++++++++++++++++++++++++++---- 1 file changed, 142 insertions(+), 13 deletions(-) (limited to 'indra/newview/lldrawpoolsimple.cpp') diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index bd180de6c6..bb50ad8e3e 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -47,6 +47,14 @@ void LLDrawPoolGlow::beginPostDeferredPass(S32 pass) { gDeferredEmissiveProgram.bind(); gDeferredEmissiveProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + if (LLPipeline::sRenderingHUDs) + { + gDeferredEmissiveProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + gDeferredEmissiveProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); + } } static LLTrace::BlockTimerStatHandle FTM_RENDER_GLOW_PUSH("Glow Push"); @@ -119,6 +127,15 @@ void LLDrawPoolGlow::render(S32 pass) shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.f); } + if (LLPipeline::sRenderingHUDs) + { + shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } + LLGLDepthTest depth(GL_TRUE, GL_FALSE); gGL.setColorMask(false, true); @@ -170,6 +187,15 @@ void LLDrawPoolSimple::beginRenderPass(S32 pass) if (mVertexShaderLevel > 0) { simple_shader->bind(); + + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } } else { @@ -263,6 +289,15 @@ void LLDrawPoolAlphaMask::beginRenderPass(S32 pass) if (mVertexShaderLevel > 0) { simple_shader->bind(); + + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } } else { @@ -296,6 +331,15 @@ void LLDrawPoolAlphaMask::render(S32 pass) simple_shader->bind(); simple_shader->setMinimumAlpha(0.33f); + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } + pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); pushMaskBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); pushMaskBatches(LLRenderPass::PASS_SPECMAP_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); @@ -336,6 +380,15 @@ void LLDrawPoolFullbrightAlphaMask::beginRenderPass(S32 pass) if (mVertexShaderLevel > 0) { simple_shader->bind(); + + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } } else { @@ -369,12 +422,24 @@ void LLDrawPoolFullbrightAlphaMask::render(S32 pass) { simple_shader->bind(); simple_shader->setMinimumAlpha(0.33f); - if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred) - { - simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); - } else { - simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); - } + + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + if (LLPipeline::sRenderDeferred) + { + simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + } + else + { + simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); + } + } } pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); //LLGLSLShader::bindNoShader(); @@ -397,6 +462,15 @@ void LLDrawPoolSimple::beginDeferredPass(S32 pass) { LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE_DEFERRED); gDeferredDiffuseProgram.bind(); + + if (LLPipeline::sRenderingHUDs) + { + gDeferredDiffuseProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + gDeferredDiffuseProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); + } } void LLDrawPoolSimple::endDeferredPass(S32 pass) @@ -435,6 +509,16 @@ void LLDrawPoolAlphaMask::renderDeferred(S32 pass) LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK_DEFERRED); gDeferredDiffuseAlphaMaskProgram.bind(); gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f); + + if (LLPipeline::sRenderingHUDs) + { + gDeferredDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + gDeferredDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); + } + pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); gDeferredDiffuseAlphaMaskProgram.unbind(); } @@ -471,6 +555,14 @@ void LLDrawPoolGrass::beginRenderPass(S32 pass) { simple_shader->bind(); simple_shader->setMinimumAlpha(0.5f); + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } } else { @@ -527,6 +619,16 @@ void LLDrawPoolGrass::renderDeferred(S32 pass) LL_RECORD_BLOCK_TIME(FTM_RENDER_GRASS_DEFERRED); gDeferredNonIndexedDiffuseAlphaMaskProgram.bind(); gDeferredNonIndexedDiffuseAlphaMaskProgram.setMinimumAlpha(0.5f); + + if (LLPipeline::sRenderingHUDs) + { + gDeferredNonIndexedDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + gDeferredNonIndexedDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); + } + //render grass LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask()); } @@ -553,6 +655,15 @@ void LLDrawPoolFullbright::beginPostDeferredPass(S32 pass) else { gDeferredFullbrightProgram.bind(); + + if (LLPipeline::sRenderingHUDs) + { + gDeferredFullbrightProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + gDeferredFullbrightProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); + } } } @@ -621,6 +732,15 @@ void LLDrawPoolFullbright::render(S32 pass) fullbright_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f); fullbright_shader->uniform1f(LLViewerShaderMgr::TEXTURE_GAMMA, 1.f); + if (LLPipeline::sRenderingHUDs) + { + fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } + U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX; pushBatches(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask, TRUE, TRUE); pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, fullbright_mask, TRUE, TRUE); @@ -651,23 +771,32 @@ S32 LLDrawPoolFullbright::getNumPasses() void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass) { - if (LLPipeline::sRenderingHUDs || !LLPipeline::sRenderDeferred) - { - gObjectFullbrightAlphaMaskProgram.bind(); + if (LLPipeline::sRenderingHUDs) + { + gObjectFullbrightAlphaMaskProgram.bind(); gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); - } - else - { - if (LLPipeline::sUnderWaterRender) + gObjectFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else if (LLPipeline::sRenderDeferred) + { + if (LLPipeline::sUnderWaterRender) { gDeferredFullbrightAlphaMaskWaterProgram.bind(); gDeferredFullbrightAlphaMaskWaterProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + gDeferredFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); } else { gDeferredFullbrightAlphaMaskProgram.bind(); gDeferredFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + gDeferredFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); } + } + else + { + gObjectFullbrightAlphaMaskProgram.bind(); + gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); + gObjectFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); } } -- cgit v1.2.3 From 7e9033821a96a9d6e80b58fafb4c7da63807b9d4 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 6 Dec 2018 10:59:11 -0800 Subject: De-duplicate deferred gbuffer access for getPosition/getNorm. De-duplicate ambient occlusion shader code and move to new aoUtil.glsl Split shared shadow tap funcs into shadowUtil.glsl --- indra/newview/lldrawpoolsimple.cpp | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'indra/newview/lldrawpoolsimple.cpp') diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index bb50ad8e3e..f653920662 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -90,7 +90,7 @@ void LLDrawPoolGlow::endPostDeferredPass(S32 pass) S32 LLDrawPoolGlow::getNumPasses() { - if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0) + if (LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT) > 0) { return 1; } @@ -111,7 +111,7 @@ void LLDrawPoolGlow::render(S32 pass) glPolygonOffset(-1.0f, -1.0f); gGL.setSceneBlendType(LLRender::BT_ADD); - U32 shader_level = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); + U32 shader_level = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); //should never get here without basic shaders enabled llassert(shader_level > 0); @@ -164,7 +164,7 @@ LLDrawPoolSimple::LLDrawPoolSimple() : void LLDrawPoolSimple::prerender() { - mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); + mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); } void LLDrawPoolSimple::beginRenderPass(S32 pass) @@ -184,7 +184,7 @@ void LLDrawPoolSimple::beginRenderPass(S32 pass) simple_shader = &gObjectSimpleProgram; } - if (mVertexShaderLevel > 0) + if (mShaderLevel > 0) { simple_shader->bind(); @@ -213,7 +213,7 @@ void LLDrawPoolSimple::endRenderPass(S32 pass) stop_glerror(); LLRenderPass::endRenderPass(pass); stop_glerror(); - if (mVertexShaderLevel > 0) + if (mShaderLevel > 0) { simple_shader->unbind(); } @@ -227,7 +227,7 @@ void LLDrawPoolSimple::render(S32 pass) LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE); gPipeline.enableLightsDynamic(); - if (mVertexShaderLevel > 0) + if (mShaderLevel > 0) { U32 mask = getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX; @@ -270,7 +270,7 @@ LLDrawPoolAlphaMask::LLDrawPoolAlphaMask() : void LLDrawPoolAlphaMask::prerender() { - mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); + mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); } void LLDrawPoolAlphaMask::beginRenderPass(S32 pass) @@ -286,7 +286,7 @@ void LLDrawPoolAlphaMask::beginRenderPass(S32 pass) simple_shader = &gObjectSimpleAlphaMaskProgram; } - if (mVertexShaderLevel > 0) + if (mShaderLevel > 0) { simple_shader->bind(); @@ -315,7 +315,7 @@ void LLDrawPoolAlphaMask::endRenderPass(S32 pass) stop_glerror(); LLRenderPass::endRenderPass(pass); stop_glerror(); - if (mVertexShaderLevel > 0) + if (mShaderLevel > 0) { simple_shader->unbind(); } @@ -326,7 +326,7 @@ void LLDrawPoolAlphaMask::render(S32 pass) LLGLDisable blend(GL_BLEND); LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK); - if (mVertexShaderLevel > 0) + if (mShaderLevel > 0) { simple_shader->bind(); simple_shader->setMinimumAlpha(0.33f); @@ -361,7 +361,7 @@ LLDrawPoolFullbrightAlphaMask::LLDrawPoolFullbrightAlphaMask() : void LLDrawPoolFullbrightAlphaMask::prerender() { - mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); + mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); } void LLDrawPoolFullbrightAlphaMask::beginRenderPass(S32 pass) @@ -377,7 +377,7 @@ void LLDrawPoolFullbrightAlphaMask::beginRenderPass(S32 pass) simple_shader = &gObjectFullbrightAlphaMaskProgram; } - if (mVertexShaderLevel > 0) + if (mShaderLevel > 0) { simple_shader->bind(); @@ -406,7 +406,7 @@ void LLDrawPoolFullbrightAlphaMask::endRenderPass(S32 pass) stop_glerror(); LLRenderPass::endRenderPass(pass); stop_glerror(); - if (mVertexShaderLevel > 0) + if (mShaderLevel > 0) { simple_shader->unbind(); } @@ -416,7 +416,7 @@ void LLDrawPoolFullbrightAlphaMask::render(S32 pass) { LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK); - if (mVertexShaderLevel > 0) + if (mShaderLevel > 0) { if (simple_shader) { @@ -533,7 +533,7 @@ LLDrawPoolGrass::LLDrawPoolGrass() : void LLDrawPoolGrass::prerender() { - mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); + mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); } @@ -551,7 +551,7 @@ void LLDrawPoolGrass::beginRenderPass(S32 pass) simple_shader = &gObjectAlphaMaskNonIndexedProgram; } - if (mVertexShaderLevel > 0) + if (mShaderLevel > 0) { simple_shader->bind(); simple_shader->setMinimumAlpha(0.5f); @@ -580,7 +580,7 @@ void LLDrawPoolGrass::endRenderPass(S32 pass) LL_RECORD_BLOCK_TIME(FTM_RENDER_GRASS); LLRenderPass::endRenderPass(pass); - if (mVertexShaderLevel > 0) + if (mShaderLevel > 0) { simple_shader->unbind(); } @@ -643,7 +643,7 @@ LLDrawPoolFullbright::LLDrawPoolFullbright() : void LLDrawPoolFullbright::prerender() { - mVertexShaderLevel = LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); + mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_OBJECT); } void LLDrawPoolFullbright::beginPostDeferredPass(S32 pass) @@ -711,7 +711,7 @@ void LLDrawPoolFullbright::endRenderPass(S32 pass) stop_glerror(); - if (mVertexShaderLevel > 0) + if (mShaderLevel > 0) { fullbright_shader->unbind(); } @@ -726,7 +726,7 @@ void LLDrawPoolFullbright::render(S32 pass) stop_glerror(); - if (mVertexShaderLevel > 0) + if (mShaderLevel > 0) { fullbright_shader->bind(); fullbright_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f); -- cgit v1.2.3 From c1d2416826406631807f153e7de9d2b790b0caa5 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 28 Feb 2019 14:06:19 -0800 Subject: EEP performance WIP Mods to improve alpha obj render performance. Removes hacky fix for HUD elements getting atmospherics. Re-orders rendering of glow to remove ~10ms/frame of shader re-re-rebinding. Fix up default classes and basic shader loading (remove unused shared modules). --- indra/newview/lldrawpoolsimple.cpp | 115 +------------------------------------ 1 file changed, 1 insertion(+), 114 deletions(-) (limited to 'indra/newview/lldrawpoolsimple.cpp') diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index f653920662..606e44185f 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -47,14 +47,6 @@ void LLDrawPoolGlow::beginPostDeferredPass(S32 pass) { gDeferredEmissiveProgram.bind(); gDeferredEmissiveProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); - if (LLPipeline::sRenderingHUDs) - { - gDeferredEmissiveProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - gDeferredEmissiveProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); - } } static LLTrace::BlockTimerStatHandle FTM_RENDER_GLOW_PUSH("Glow Push"); @@ -127,15 +119,6 @@ void LLDrawPoolGlow::render(S32 pass) shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.f); } - if (LLPipeline::sRenderingHUDs) - { - shader->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - shader->uniform1i(LLShaderMgr::NO_ATMO, 0); - } - LLGLDepthTest depth(GL_TRUE, GL_FALSE); gGL.setColorMask(false, true); @@ -187,15 +170,6 @@ void LLDrawPoolSimple::beginRenderPass(S32 pass) if (mShaderLevel > 0) { simple_shader->bind(); - - if (LLPipeline::sRenderingHUDs) - { - simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); - } } else { @@ -289,15 +263,6 @@ void LLDrawPoolAlphaMask::beginRenderPass(S32 pass) if (mShaderLevel > 0) { simple_shader->bind(); - - if (LLPipeline::sRenderingHUDs) - { - simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); - } } else { @@ -331,15 +296,6 @@ void LLDrawPoolAlphaMask::render(S32 pass) simple_shader->bind(); simple_shader->setMinimumAlpha(0.33f); - if (LLPipeline::sRenderingHUDs) - { - simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); - } - pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); pushMaskBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); pushMaskBatches(LLRenderPass::PASS_SPECMAP_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); @@ -380,15 +336,6 @@ void LLDrawPoolFullbrightAlphaMask::beginRenderPass(S32 pass) if (mShaderLevel > 0) { simple_shader->bind(); - - if (LLPipeline::sRenderingHUDs) - { - simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); - } } else { @@ -425,12 +372,10 @@ void LLDrawPoolFullbrightAlphaMask::render(S32 pass) if (LLPipeline::sRenderingHUDs) { - simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); } else { - simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); if (LLPipeline::sRenderDeferred) { simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); @@ -462,15 +407,6 @@ void LLDrawPoolSimple::beginDeferredPass(S32 pass) { LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE_DEFERRED); gDeferredDiffuseProgram.bind(); - - if (LLPipeline::sRenderingHUDs) - { - gDeferredDiffuseProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - gDeferredDiffuseProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); - } } void LLDrawPoolSimple::endDeferredPass(S32 pass) @@ -509,16 +445,6 @@ void LLDrawPoolAlphaMask::renderDeferred(S32 pass) LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK_DEFERRED); gDeferredDiffuseAlphaMaskProgram.bind(); gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f); - - if (LLPipeline::sRenderingHUDs) - { - gDeferredDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - gDeferredDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); - } - pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); gDeferredDiffuseAlphaMaskProgram.unbind(); } @@ -555,14 +481,6 @@ void LLDrawPoolGrass::beginRenderPass(S32 pass) { simple_shader->bind(); simple_shader->setMinimumAlpha(0.5f); - if (LLPipeline::sRenderingHUDs) - { - simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); - } } else { @@ -619,16 +537,7 @@ void LLDrawPoolGrass::renderDeferred(S32 pass) LL_RECORD_BLOCK_TIME(FTM_RENDER_GRASS_DEFERRED); gDeferredNonIndexedDiffuseAlphaMaskProgram.bind(); gDeferredNonIndexedDiffuseAlphaMaskProgram.setMinimumAlpha(0.5f); - - if (LLPipeline::sRenderingHUDs) - { - gDeferredNonIndexedDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - gDeferredNonIndexedDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); - } - + gDeferredNonIndexedDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); //render grass LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask()); } @@ -655,15 +564,6 @@ void LLDrawPoolFullbright::beginPostDeferredPass(S32 pass) else { gDeferredFullbrightProgram.bind(); - - if (LLPipeline::sRenderingHUDs) - { - gDeferredFullbrightProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - gDeferredFullbrightProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); - } } } @@ -732,15 +632,6 @@ void LLDrawPoolFullbright::render(S32 pass) fullbright_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f); fullbright_shader->uniform1f(LLViewerShaderMgr::TEXTURE_GAMMA, 1.f); - if (LLPipeline::sRenderingHUDs) - { - fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); - } - else - { - fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); - } - U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX; pushBatches(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask, TRUE, TRUE); pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, fullbright_mask, TRUE, TRUE); @@ -775,7 +666,6 @@ void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass) { gObjectFullbrightAlphaMaskProgram.bind(); gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); - gObjectFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); } else if (LLPipeline::sRenderDeferred) { @@ -783,20 +673,17 @@ void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass) { gDeferredFullbrightAlphaMaskWaterProgram.bind(); gDeferredFullbrightAlphaMaskWaterProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); - gDeferredFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); } else { gDeferredFullbrightAlphaMaskProgram.bind(); gDeferredFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); - gDeferredFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); } } else { gObjectFullbrightAlphaMaskProgram.bind(); gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); - gObjectFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); } } -- cgit v1.2.3 From 4c3050a3953153aa8753fc10706ad2ef464f3e3d Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Sun, 3 Mar 2019 10:42:19 -0800 Subject: SL-10664, SL-10666 Fix up culling issues from perf work and fix Depth of Field rendering to get depth values properly. Baseline for performance work. --- indra/newview/lldrawpoolsimple.cpp | 115 ++++++++++++++++++++++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-) (limited to 'indra/newview/lldrawpoolsimple.cpp') diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index 606e44185f..f653920662 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -47,6 +47,14 @@ void LLDrawPoolGlow::beginPostDeferredPass(S32 pass) { gDeferredEmissiveProgram.bind(); gDeferredEmissiveProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + if (LLPipeline::sRenderingHUDs) + { + gDeferredEmissiveProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + gDeferredEmissiveProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); + } } static LLTrace::BlockTimerStatHandle FTM_RENDER_GLOW_PUSH("Glow Push"); @@ -119,6 +127,15 @@ void LLDrawPoolGlow::render(S32 pass) shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.f); } + if (LLPipeline::sRenderingHUDs) + { + shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } + LLGLDepthTest depth(GL_TRUE, GL_FALSE); gGL.setColorMask(false, true); @@ -170,6 +187,15 @@ void LLDrawPoolSimple::beginRenderPass(S32 pass) if (mShaderLevel > 0) { simple_shader->bind(); + + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } } else { @@ -263,6 +289,15 @@ void LLDrawPoolAlphaMask::beginRenderPass(S32 pass) if (mShaderLevel > 0) { simple_shader->bind(); + + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } } else { @@ -296,6 +331,15 @@ void LLDrawPoolAlphaMask::render(S32 pass) simple_shader->bind(); simple_shader->setMinimumAlpha(0.33f); + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } + pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); pushMaskBatches(LLRenderPass::PASS_MATERIAL_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); pushMaskBatches(LLRenderPass::PASS_SPECMAP_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); @@ -336,6 +380,15 @@ void LLDrawPoolFullbrightAlphaMask::beginRenderPass(S32 pass) if (mShaderLevel > 0) { simple_shader->bind(); + + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } } else { @@ -372,10 +425,12 @@ void LLDrawPoolFullbrightAlphaMask::render(S32 pass) if (LLPipeline::sRenderingHUDs) { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); } else { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); if (LLPipeline::sRenderDeferred) { simple_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); @@ -407,6 +462,15 @@ void LLDrawPoolSimple::beginDeferredPass(S32 pass) { LL_RECORD_BLOCK_TIME(FTM_RENDER_SIMPLE_DEFERRED); gDeferredDiffuseProgram.bind(); + + if (LLPipeline::sRenderingHUDs) + { + gDeferredDiffuseProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + gDeferredDiffuseProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); + } } void LLDrawPoolSimple::endDeferredPass(S32 pass) @@ -445,6 +509,16 @@ void LLDrawPoolAlphaMask::renderDeferred(S32 pass) LL_RECORD_BLOCK_TIME(FTM_RENDER_ALPHA_MASK_DEFERRED); gDeferredDiffuseAlphaMaskProgram.bind(); gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f); + + if (LLPipeline::sRenderingHUDs) + { + gDeferredDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + gDeferredDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); + } + pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); gDeferredDiffuseAlphaMaskProgram.unbind(); } @@ -481,6 +555,14 @@ void LLDrawPoolGrass::beginRenderPass(S32 pass) { simple_shader->bind(); simple_shader->setMinimumAlpha(0.5f); + if (LLPipeline::sRenderingHUDs) + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + simple_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } } else { @@ -537,7 +619,16 @@ void LLDrawPoolGrass::renderDeferred(S32 pass) LL_RECORD_BLOCK_TIME(FTM_RENDER_GRASS_DEFERRED); gDeferredNonIndexedDiffuseAlphaMaskProgram.bind(); gDeferredNonIndexedDiffuseAlphaMaskProgram.setMinimumAlpha(0.5f); - gDeferredNonIndexedDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); + + if (LLPipeline::sRenderingHUDs) + { + gDeferredNonIndexedDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + gDeferredNonIndexedDiffuseAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); + } + //render grass LLRenderPass::renderTexture(LLRenderPass::PASS_GRASS, getVertexDataMask()); } @@ -564,6 +655,15 @@ void LLDrawPoolFullbright::beginPostDeferredPass(S32 pass) else { gDeferredFullbrightProgram.bind(); + + if (LLPipeline::sRenderingHUDs) + { + gDeferredFullbrightProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + gDeferredFullbrightProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); + } } } @@ -632,6 +732,15 @@ void LLDrawPoolFullbright::render(S32 pass) fullbright_shader->uniform1f(LLViewerShaderMgr::FULLBRIGHT, 1.f); fullbright_shader->uniform1f(LLViewerShaderMgr::TEXTURE_GAMMA, 1.f); + if (LLPipeline::sRenderingHUDs) + { + fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 1); + } + else + { + fullbright_shader->uniform1i(LLShaderMgr::NO_ATMO, 0); + } + U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXTURE_INDEX; pushBatches(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask, TRUE, TRUE); pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, fullbright_mask, TRUE, TRUE); @@ -666,6 +775,7 @@ void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass) { gObjectFullbrightAlphaMaskProgram.bind(); gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); + gObjectFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); } else if (LLPipeline::sRenderDeferred) { @@ -673,17 +783,20 @@ void LLDrawPoolFullbrightAlphaMask::beginPostDeferredPass(S32 pass) { gDeferredFullbrightAlphaMaskWaterProgram.bind(); gDeferredFullbrightAlphaMaskWaterProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + gDeferredFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 1); } else { gDeferredFullbrightAlphaMaskProgram.bind(); gDeferredFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); + gDeferredFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); } } else { gObjectFullbrightAlphaMaskProgram.bind(); gObjectFullbrightAlphaMaskProgram.uniform1f(LLShaderMgr::TEXTURE_GAMMA, 1.0f); + gObjectFullbrightAlphaMaskProgram.uniform1i(LLShaderMgr::NO_ATMO, 0); } } -- cgit v1.2.3 From 58f7b981bdb415311f23dfffc39e7a841b3017a0 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 31 May 2019 13:47:44 -0700 Subject: SL-11337 Fix handling of ambient (was getting reset to 1,1,1,1 unintentionally). Modify shaders to balance ambient across render modes again. --- indra/newview/lldrawpoolsimple.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/lldrawpoolsimple.cpp') diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp index f653920662..f211cf6e27 100644 --- a/indra/newview/lldrawpoolsimple.cpp +++ b/indra/newview/lldrawpoolsimple.cpp @@ -447,7 +447,7 @@ void LLDrawPoolFullbrightAlphaMask::render(S32 pass) else { LLGLEnable test(GL_ALPHA_TEST); - gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); + gPipeline.enableLightsFullbright(); pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE); gPipeline.enableLightsDynamic(); gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK @@ -750,7 +750,7 @@ void LLDrawPoolFullbright::render(S32 pass) } else { - gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); + gPipeline.enableLightsFullbright(); U32 fullbright_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_COLOR; renderTexture(LLRenderPass::PASS_FULLBRIGHT, fullbright_mask); pushBatches(LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, fullbright_mask); -- cgit v1.2.3