Adding optimization to skip alpha image analysis when it isn't needed.
parent
fe52f09952
commit
8c0aa31536
|
|
@ -288,7 +288,6 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
|||
(mCachedProcessedTexture->getHeight() != image_tga_height) ||
|
||||
(weight_changed))
|
||||
{
|
||||
// llinfos << "Building Cached Alpha: " << mName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << effective_weight << llendl;
|
||||
mCachedEffectiveWeight = effective_weight;
|
||||
|
||||
if (!mCachedProcessedTexture)
|
||||
|
|
@ -307,6 +306,7 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
|||
mStaticImageRaw = new LLImageRaw;
|
||||
mStaticImageTGA->decodeAndProcess(mStaticImageRaw, info->mDomain, effective_weight);
|
||||
mNeedsCreateTexture = TRUE;
|
||||
lldebugs << "Built Cached Alpha: " << info->mStaticImageFileName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << "Domain: " << info->mDomain << " Weight: " << effective_weight << llendl;
|
||||
}
|
||||
|
||||
if (mCachedProcessedTexture)
|
||||
|
|
|
|||
|
|
@ -132,12 +132,12 @@ BOOL LLImageTGA::updateData()
|
|||
** FIELD 2 : COLOR MAP TYPE (1 BYTES)
|
||||
** FIELD 3 : IMAGE TYPE CODE (1 BYTES)
|
||||
** = 0 NO IMAGE DATA INCLUDED
|
||||
** = 1 UNCOMPRESSED, COLOR-MAPPED IMAGE
|
||||
** = 2 UNCOMPRESSED, TRUE-COLOR IMAGE
|
||||
** = 3 UNCOMPRESSED, BLACK AND WHITE IMAGE
|
||||
** = 9 RUN-LENGTH ENCODED COLOR-MAPPED IMAGE
|
||||
** = 10 RUN-LENGTH ENCODED TRUE-COLOR IMAGE
|
||||
** = 11 RUN-LENGTH ENCODED BLACK AND WHITE IMAGE
|
||||
** = (0001) 1 UNCOMPRESSED, COLOR-MAPPED IMAGE
|
||||
** = (0010) 2 UNCOMPRESSED, TRUE-COLOR IMAGE
|
||||
** = (0011) 3 UNCOMPRESSED, BLACK AND WHITE IMAGE
|
||||
** = (1001) 9 RUN-LENGTH ENCODED COLOR-MAPPED IMAGE
|
||||
** = (1010) 10 RUN-LENGTH ENCODED TRUE-COLOR IMAGE
|
||||
** = (1011) 11 RUN-LENGTH ENCODED BLACK AND WHITE IMAGE
|
||||
** FIELD 4 : COLOR MAP SPECIFICATION (5 BYTES)
|
||||
** 4.1 : COLOR MAP ORIGIN (2 BYTES)
|
||||
** 4.2 : COLOR MAP LENGTH (2 BYTES)
|
||||
|
|
|
|||
|
|
@ -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 ;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -1641,7 +1641,8 @@ LLViewerWindow::LLViewerWindow(const Params& p)
|
|||
|
||||
// Init the image list. Must happen after GL is initialized and before the images that
|
||||
// LLViewerWindow needs are requested.
|
||||
LLImageGL::initClass(LLGLTexture::MAX_GL_IMAGE_CATEGORY) ;
|
||||
const BOOL SKIP_ANALYZE_ALPHA=FALSE;
|
||||
LLImageGL::initClass(LLGLTexture::MAX_GL_IMAGE_CATEGORY, SKIP_ANALYZE_ALPHA) ;
|
||||
gTextureList.init();
|
||||
LLViewerTextureManager::init() ;
|
||||
gBumpImageList.init();
|
||||
|
|
|
|||
Loading…
Reference in New Issue