summaryrefslogtreecommitdiff
path: root/indra/llrender/llrender.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2010-02-06 20:50:49 -0600
committerDave Parks <davep@lindenlab.com>2010-02-06 20:50:49 -0600
commit4538bdd8e9c0aaecec918fe9e9f784d7cae23387 (patch)
treed521f8a63314328b129c0f1930df171407a1fdce /indra/llrender/llrender.cpp
parentadf601ef1f46e5728988a08068cb2a8b16c7a056 (diff)
Fix for bad GL blend function caching.
Diffstat (limited to 'indra/llrender/llrender.cpp')
-rw-r--r--indra/llrender/llrender.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index d2dc1104a8..c11675fa48 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -763,7 +763,8 @@ LLRender::LLRender()
mCurrAlphaFunc = CF_DEFAULT;
mCurrAlphaFuncVal = 0.01f;
- mCurrSceneBlendType = BT_ALPHA;
+ mCurrBlendSFactor = BF_SOURCE_ALPHA;
+ mCurrBlendDFactor = BF_ONE_MINUS_SOURCE_ALPHA;
}
LLRender::~LLRender()
@@ -922,40 +923,33 @@ void LLRender::setColorMask(bool writeColorR, bool writeColorG, bool writeColorB
void LLRender::setSceneBlendType(eBlendType type)
{
- if (mCurrSceneBlendType == type)
- {
- return;
- }
-
- flush();
switch (type)
{
case BT_ALPHA:
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ blendFunc(BF_SOURCE_ALPHA, BF_ONE_MINUS_SOURCE_ALPHA);
break;
case BT_ADD:
- glBlendFunc(GL_ONE, GL_ONE);
+ blendFunc(BF_ONE, BF_ONE);
break;
case BT_ADD_WITH_ALPHA:
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ blendFunc(BF_SOURCE_ALPHA, BF_ONE);
break;
case BT_MULT:
- glBlendFunc(GL_DST_COLOR, GL_ZERO);
+ blendFunc(BF_DEST_COLOR, BF_ZERO);
break;
case BT_MULT_ALPHA:
- glBlendFunc(GL_DST_ALPHA, GL_ZERO);
+ blendFunc(BF_DEST_ALPHA, BF_ZERO);
break;
case BT_MULT_X2:
- glBlendFunc(GL_DST_COLOR, GL_SRC_COLOR);
+ blendFunc(BF_DEST_COLOR, BF_SOURCE_COLOR);
break;
case BT_REPLACE:
- glBlendFunc(GL_ONE, GL_ZERO);
+ blendFunc(BF_ONE, BF_ZERO);
break;
default:
llerrs << "Unknown Scene Blend Type: " << type << llendl;
break;
}
- mCurrSceneBlendType = type;
}
void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
@@ -976,8 +970,13 @@ void LLRender::setAlphaRejectSettings(eCompareFunc func, F32 value)
void LLRender::blendFunc(eBlendFactor sfactor, eBlendFactor dfactor)
{
- flush();
- glBlendFunc(sGLBlendFactor[sfactor], sGLBlendFactor[dfactor]);
+ if (mCurrBlendSFactor != sfactor || mCurrBlendDFactor != dfactor)
+ {
+ mCurrBlendSFactor = sfactor;
+ mCurrBlendDFactor = dfactor;
+ flush();
+ glBlendFunc(sGLBlendFactor[sfactor], sGLBlendFactor[dfactor]);
+ }
}
LLTexUnit* LLRender::getTexUnit(U32 index)