summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-03-08 14:51:27 +0000
committerTofu Linden <tofu.linden@lindenlab.com>2010-03-08 14:51:27 +0000
commitfa29257c8fa82cd7b04663868744b06ea58294f0 (patch)
treee6c55fa7b4779106c7d68aa07f5d597cdaa0e3d4
parent9beeb33f091083d10be3169930b9c205efc2821b (diff)
VWR-4214 followup
Make the fix work for alpha masks ('fast alpha') too - ironically this hasn't ever worked either AFAICT.
-rw-r--r--indra/newview/lldrawpoolalpha.cpp26
-rw-r--r--indra/newview/lldrawpoolalpha.h7
2 files changed, 26 insertions, 7 deletions
diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 9a778a063d..7fd7cd3910 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -60,7 +60,9 @@ static BOOL deferred_render = FALSE;
LLDrawPoolAlpha::LLDrawPoolAlpha(U32 type) :
LLRenderPass(type), current_shader(NULL), target_shader(NULL),
- simple_shader(NULL), fullbright_shader(NULL)
+ simple_shader(NULL), fullbright_shader(NULL),
+ mColorSFactor(LLRender::BF_UNDEF), mColorDFactor(LLRender::BF_UNDEF),
+ mAlphaSFactor(LLRender::BF_UNDEF), mAlphaDFactor(LLRender::BF_UNDEF)
{
}
@@ -178,9 +180,16 @@ void LLDrawPoolAlpha::render(S32 pass)
LLGLSPipelineAlpha gls_pipeline_alpha;
+ gGL.setColorMask(true, true);
+
if (LLPipeline::sFastAlpha && !deferred_render)
{
- LLGLDisable blend_disable(GL_BLEND);
+ mColorSFactor = LLRender::BF_ONE; // }
+ mColorDFactor = LLRender::BF_ZERO; // } these are like disabling blend on the color channels, but we're still blending on the alpha channel so that we can suppress glow
+ mAlphaSFactor = LLRender::BF_ZERO;
+ mAlphaDFactor = LLRender::BF_ZERO; // block (zero-out) glow where the alpha test succeeds
+ gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
+
gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.33f);
if (mVertexShaderLevel > 0)
{
@@ -205,10 +214,14 @@ void LLDrawPoolAlpha::render(S32 pass)
LLGLDepthTest depth(GL_TRUE, LLDrawPoolWater::sSkipScreenCopy ? GL_TRUE : GL_FALSE);
- gGL.setColorMask(true, true);
- gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA,
- LLRender::BF_ZERO, LLRender::BF_ONE_MINUS_SOURCE_ALPHA);
+ mColorSFactor = LLRender::BF_SOURCE_ALPHA; // } regular alpha blend
+ mColorDFactor = LLRender::BF_ONE_MINUS_SOURCE_ALPHA; // }
+ mAlphaSFactor = LLRender::BF_ZERO; // } glow suppression
+ mAlphaDFactor = LLRender::BF_ONE_MINUS_SOURCE_ALPHA; // }
+ gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
+
renderAlpha(getVertexDataMask());
+
gGL.setColorMask(true, false);
if (deferred_render && current_shader != NULL)
@@ -417,8 +430,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
gPipeline.addTrianglesDrawn(params.mCount, params.mDrawMode);
// restore our alpha blend mode
- gGL.blendFunc(LLRender::BF_SOURCE_ALPHA, LLRender::BF_ONE_MINUS_SOURCE_ALPHA,
- LLRender::BF_ZERO, LLRender::BF_ONE_MINUS_SOURCE_ALPHA);
+ gGL.blendFunc(mColorSFactor, mColorDFactor, mAlphaSFactor, mAlphaDFactor);
}
if (params.mTextureMatrix && params.mTexture.notNull())
diff --git a/indra/newview/lldrawpoolalpha.h b/indra/newview/lldrawpoolalpha.h
index 3aa752f72c..61f73d0b31 100644
--- a/indra/newview/lldrawpoolalpha.h
+++ b/indra/newview/lldrawpoolalpha.h
@@ -34,6 +34,7 @@
#define LL_LLDRAWPOOLALPHA_H
#include "lldrawpool.h"
+#include "llrender.h"
#include "llframetimer.h"
class LLFace;
@@ -83,6 +84,12 @@ private:
LLGLSLShader* target_shader;
LLGLSLShader* simple_shader;
LLGLSLShader* fullbright_shader;
+
+ // our 'normal' alpha blend function for this pass
+ LLRender::eBlendFactor mColorSFactor;
+ LLRender::eBlendFactor mColorDFactor;
+ LLRender::eBlendFactor mAlphaSFactor;
+ LLRender::eBlendFactor mAlphaDFactor;
};
class LLDrawPoolAlphaPostWater : public LLDrawPoolAlpha