diff options
author | Dave Parks <davep@lindenlab.com> | 2010-02-06 20:50:49 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2010-02-06 20:50:49 -0600 |
commit | ce504224de16776ade2a01adfbd5410fae6942cc (patch) | |
tree | a54d4e74a6214b610aba7e0b63940e5988bd143f /indra/llrender | |
parent | 095a5e84408b47ef3c5610e111aefe51d77633ca (diff) |
Fix for bad GL blend function caching.
Diffstat (limited to 'indra/llrender')
-rw-r--r-- | indra/llrender/llrender.cpp | 33 | ||||
-rw-r--r-- | indra/llrender/llrender.h | 3 |
2 files changed, 18 insertions, 18 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) diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h index 6e38fac67b..a70ccf4d80 100644 --- a/indra/llrender/llrender.h +++ b/indra/llrender/llrender.h @@ -360,7 +360,8 @@ private: std::vector<LLTexUnit*> mTexUnits; LLTexUnit* mDummyTexUnit; - U32 mCurrSceneBlendType; + U32 mCurrBlendSFactor; + U32 mCurrBlendDFactor; F32 mMaxAnisotropy; |