diff options
author | Don Kjer <don@lindenlab.com> | 2012-10-04 00:42:31 +0000 |
---|---|---|
committer | Don Kjer <don@lindenlab.com> | 2012-10-04 00:42:31 +0000 |
commit | 8c0aa31536c447edb6ef4fbee43f99debf593a20 (patch) | |
tree | f12847d717afae2a57a68e614e6dd602396847e0 /indra/llrender | |
parent | fe52f09952c78534377f26fc2eef9acff4a9b24d (diff) |
Adding optimization to skip alpha image analysis when it isn't needed.
Diffstat (limited to 'indra/llrender')
-rwxr-xr-x | indra/llrender/llimagegl.cpp | 14 | ||||
-rwxr-xr-x | indra/llrender/llimagegl.h | 5 |
2 files changed, 15 insertions, 4 deletions
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index d561f63544..44224ba72f 100755 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -74,6 +74,9 @@ S32 LLImageGL::sCurTexSizeBar = -1 ; S32 LLImageGL::sCurTexPickSize = -1 ; S32 LLImageGL::sMaxCategories = 1 ; +//optimization for when we don't need to calculate mIsMask +BOOL LLImageGL::sSkipAnalyzeAlpha; + //------------------------ //**************************************************************************************************** //End for texture auditing use only @@ -169,8 +172,9 @@ BOOL is_little_endian() return (*c == 0x78) ; } //static -void LLImageGL::initClass(S32 num_catagories) +void LLImageGL::initClass(S32 num_catagories, BOOL skip_analyze_alpha /* = false */) { + sSkipAnalyzeAlpha = skip_analyze_alpha; } //static @@ -1700,6 +1704,12 @@ BOOL LLImageGL::getBoundRecently() const return (BOOL)(sLastFrameTime - mLastBindTime < MIN_TEXTURE_LIFETIME); } +BOOL LLImageGL::getIsAlphaMask() const +{ + llassert_always(!sSkipAnalyzeAlpha); + return mIsMask; +} + void LLImageGL::setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target) { mTarget = target; @@ -1797,7 +1807,7 @@ void LLImageGL::calcAlphaChannelOffsetAndStride() void LLImageGL::analyzeAlpha(const void* data_in, U32 w, U32 h) { - if(!mNeedsAlphaAndPickMask) + if(sSkipAnalyzeAlpha || !mNeedsAlphaAndPickMask) { return ; } diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index cf3c484c79..57a052b258 100755 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -142,7 +142,7 @@ public: BOOL getHasGLTexture() const { return mTexName != 0; } LLGLuint getTexName() const { return mTexName; } - BOOL getIsAlphaMask() const { return mIsMask; } + BOOL getIsAlphaMask() const; BOOL getIsResident(BOOL test_now = FALSE); // not const @@ -262,11 +262,12 @@ public: #endif public: - static void initClass(S32 num_catagories) ; + static void initClass(S32 num_catagories, BOOL skip_analyze_alpha = false); static void cleanupClass() ; private: static S32 sMaxCategories; + static BOOL sSkipAnalyzeAlpha; //the flag to allow to call readBackRaw(...). //can be removed if we do not use that function at all. |