summaryrefslogtreecommitdiff
path: root/indra/newview
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
commit6de84031ee5c786b1a773d9d35f499c7c7a5ec20 (patch)
tree4571912a95efb9da6adddc590fcc3cf8d04f7282 /indra/newview
parent5461959d33f2cccfcacfe7887622d68e1c94ad12 (diff)
VWR-4214 followup
Make the fix work for alpha masks ('fast alpha') too - ironically this hasn't ever worked either AFAICT.
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lldrawpoolalpha.cpp26
-rw-r--r--indra/newview/lldrawpoolalpha.h43
2 files changed, 47 insertions, 22 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 0477093afa..61f73d0b31 100644
--- a/indra/newview/lldrawpoolalpha.h
+++ b/indra/newview/lldrawpoolalpha.h
@@ -2,25 +2,31 @@
* @file lldrawpoolalpha.h
* @brief LLDrawPoolAlpha class definition
*
- * $LicenseInfo:firstyear=2002&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ *
+ * Copyright (c) 2002-2009, Linden Research, Inc.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab. Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
*
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
@@ -28,6 +34,7 @@
#define LL_LLDRAWPOOLALPHA_H
#include "lldrawpool.h"
+#include "llrender.h"
#include "llframetimer.h"
class LLFace;
@@ -77,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