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 | |
parent | 095a5e84408b47ef3c5610e111aefe51d77633ca (diff) |
Fix for bad GL blend function caching.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llrender/llrender.cpp | 33 | ||||
-rw-r--r-- | indra/llrender/llrender.h | 3 | ||||
-rw-r--r-- | indra/newview/llselectmgr.cpp | 19 |
3 files changed, 31 insertions, 24 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; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 9540894646..d733574a9d 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -4919,13 +4919,15 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) // set up transform to encompass bounding box of HUD glMatrixMode(GL_PROJECTION); - glPushMatrix(); + gGL.pushMatrix(); glLoadIdentity(); F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f); glOrtho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth); glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.pushMatrix(); + gGL.pushUIMatrix(); + gGL.loadUIIdentity(); glLoadIdentity(); glLoadMatrixf(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame glTranslatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f); @@ -5022,10 +5024,11 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) if (for_hud && avatar) { glMatrixMode(GL_PROJECTION); - glPopMatrix(); + gGL.popMatrix(); glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.popMatrix(); + gGL.popUIMatrix(); stop_glerror(); } @@ -5374,7 +5377,10 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) } glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.pushMatrix(); + gGL.pushUIMatrix(); + gGL.loadUIIdentity(); + if (!is_hud_object) { glLoadIdentity(); @@ -5493,7 +5499,8 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) gGL.end(); gGL.flush(); } - glPopMatrix(); + gGL.popMatrix(); + gGL.popUIMatrix(); } // |