summaryrefslogtreecommitdiff
path: root/indra/newview/lldrawpoolalpha.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lldrawpoolalpha.cpp')
-rw-r--r--indra/newview/lldrawpoolalpha.cpp45
1 files changed, 39 insertions, 6 deletions
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index a2428d2de0..2519d0297c 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -103,16 +103,29 @@ void LLDrawPoolAlpha::renderDeferred(S32 pass)
S32 LLDrawPoolAlpha::getNumPostDeferredPasses()
{
- return 1;
+ return 2;
}
void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)
{
LLFastTimer t(FTM_RENDER_ALPHA);
- simple_shader = &gDeferredAlphaProgram;
- fullbright_shader = &gDeferredFullbrightProgram;
-
+ if (pass == 0)
+ {
+ simple_shader = &gDeferredAlphaProgram;
+ fullbright_shader = &gDeferredFullbrightProgram;
+ }
+ else
+ {
+ //update depth buffer sampler
+ gPipeline.mScreen.flush();
+ gPipeline.mDeferredDepth.copyContents(gPipeline.mDeferredScreen, 0, 0, gPipeline.mDeferredScreen.getWidth(), gPipeline.mDeferredScreen.getHeight(),
+ 0, 0, gPipeline.mDeferredDepth.getWidth(), gPipeline.mDeferredDepth.getHeight(), GL_DEPTH_BUFFER_BIT, GL_NEAREST);
+ gPipeline.mDeferredDepth.bindTarget();
+ simple_shader = NULL;
+ fullbright_shader = NULL;
+ }
+
deferred_render = TRUE;
if (mVertexShaderLevel > 0)
{
@@ -124,6 +137,8 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)
void LLDrawPoolAlpha::endPostDeferredPass(S32 pass)
{
+ gPipeline.mDeferredDepth.flush();
+ gPipeline.mScreen.bindTarget();
deferred_render = FALSE;
endRenderPass(pass);
}
@@ -174,7 +189,14 @@ void LLDrawPoolAlpha::render(S32 pass)
LLGLSPipelineAlpha gls_pipeline_alpha;
- gGL.setColorMask(true, true);
+ if (deferred_render && pass == 1)
+ { //depth only
+ gGL.setColorMask(false, false);
+ }
+ else
+ {
+ gGL.setColorMask(true, true);
+ }
if (LLPipeline::sAutoMaskAlphaNonDeferred && !deferred_render)
{
@@ -206,7 +228,13 @@ void LLDrawPoolAlpha::render(S32 pass)
gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
}
- LLGLDepthTest depth(GL_TRUE, LLDrawPoolWater::sSkipScreenCopy ? GL_TRUE : GL_FALSE);
+ LLGLDepthTest depth(GL_TRUE, LLDrawPoolWater::sSkipScreenCopy ||
+ (deferred_render && pass == 1) ? GL_TRUE : GL_FALSE);
+
+ if (deferred_render && pass == 1)
+ {
+ gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.33f);
+ }
mColorSFactor = LLRender::BF_SOURCE_ALPHA; // } regular alpha blend
mColorDFactor = LLRender::BF_ONE_MINUS_SOURCE_ALPHA; // }
@@ -218,6 +246,11 @@ void LLDrawPoolAlpha::render(S32 pass)
gGL.setColorMask(true, false);
+ if (deferred_render && pass == 1)
+ {
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ }
+
if (deferred_render && current_shader != NULL)
{
gPipeline.unbindDeferredShader(*current_shader);