diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-03-07 18:31:32 +0000 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-03-07 18:31:32 +0000 |
commit | 0604715af6eaaa415cfae5a76e918abeb10e9eff (patch) | |
tree | d39be07298deb15ed170d9d45f107afa97ccfd94 /indra/llrender/llrender.cpp | |
parent | 18432d1bc5bdab244b6054af73c5e4cf3d855164 (diff) |
Add support for glBlendFuncSeparate().
I want it to fix glow-through-alpha, but this checkin doesn't includes any of those changes.
Diffstat (limited to 'indra/llrender/llrender.cpp')
-rw-r--r-- | indra/llrender/llrender.cpp | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index c3540a717c..5597b23c69 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -778,8 +778,10 @@ LLRender::LLRender() mCurrAlphaFunc = CF_DEFAULT; mCurrAlphaFuncVal = 0.01f; - mCurrBlendSFactor = BF_UNDEF; - mCurrBlendDFactor = BF_UNDEF; + mCurrBlendColorSFactor = BF_UNDEF; + mCurrBlendAlphaSFactor = BF_UNDEF; + mCurrBlendColorDFactor = BF_UNDEF; + mCurrBlendAlphaDFactor = BF_UNDEF; } LLRender::~LLRender() @@ -995,15 +997,44 @@ void LLRender::blendFunc(eBlendFactor sfactor, eBlendFactor dfactor) { llassert(sfactor < BF_UNDEF); llassert(dfactor < BF_UNDEF); - if (mCurrBlendSFactor != sfactor || mCurrBlendDFactor != dfactor) + if (mCurrBlendColorSFactor != sfactor || mCurrBlendColorDFactor != dfactor || + mCurrBlendAlphaSFactor != sfactor || mCurrBlendAlphaDFactor != dfactor) { - mCurrBlendSFactor = sfactor; - mCurrBlendDFactor = dfactor; + mCurrBlendColorSFactor = sfactor; + mCurrBlendAlphaSFactor = sfactor; + mCurrBlendColorDFactor = dfactor; + mCurrBlendAlphaDFactor = dfactor; flush(); glBlendFunc(sGLBlendFactor[sfactor], sGLBlendFactor[dfactor]); } } +void LLRender::blendFunc(eBlendFactor color_sfactor, eBlendFactor color_dfactor, + eBlendFactor alpha_sfactor, eBlendFactor alpha_dfactor) +{ + llassert(color_sfactor < BF_UNDEF); + llassert(color_dfactor < BF_UNDEF); + llassert(alpha_sfactor < BF_UNDEF); + llassert(alpha_dfactor < BF_UNDEF); + if (!gGLManager.mHasBlendFuncSeparate) + { + LL_WARNS_ONCE("render") << "no glBlendFuncSeparateEXT(), using color-only blend func" << llendl; + blendFunc(color_sfactor, color_dfactor); + return; + } + if (mCurrBlendColorSFactor != color_sfactor || mCurrBlendColorDFactor != color_dfactor || + mCurrBlendAlphaSFactor != alpha_sfactor || mCurrBlendAlphaDFactor != alpha_dfactor) + { + mCurrBlendColorSFactor = color_sfactor; + mCurrBlendAlphaSFactor = alpha_sfactor; + mCurrBlendColorDFactor = color_dfactor; + mCurrBlendAlphaDFactor = alpha_dfactor; + flush(); + glBlendFuncSeparateEXT(sGLBlendFactor[color_sfactor], sGLBlendFactor[color_dfactor], + sGLBlendFactor[alpha_sfactor], sGLBlendFactor[alpha_dfactor]); + } +} + LLTexUnit* LLRender::getTexUnit(U32 index) { if (index < mTexUnits.size()) |