Texture console now shows number of 'cached' raw images.
png loading now immediately dumps allocated data on failure
This commit is contained in:
@@ -248,16 +248,17 @@ U8* LLImageBase::allocateDataSize(S32 width, S32 height, S32 ncomponents, S32 si
|
||||
|
||||
S32 LLImageRaw::sGlobalRawMemory = 0;
|
||||
S32 LLImageRaw::sRawImageCount = 0;
|
||||
S32 LLImageRaw::sRawImageCachedCount = 0;
|
||||
|
||||
LLImageRaw::LLImageRaw()
|
||||
: LLImageBase()
|
||||
: LLImageBase(), mCacheEntries(0)
|
||||
{
|
||||
mMemType = LLMemType::MTYPE_IMAGERAW;
|
||||
++sRawImageCount;
|
||||
}
|
||||
|
||||
LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components)
|
||||
: LLImageBase()
|
||||
: LLImageBase(), mCacheEntries(0)
|
||||
{
|
||||
mMemType = LLMemType::MTYPE_IMAGERAW;
|
||||
llassert( S32(width) * S32(height) * S32(components) <= MAX_IMAGE_DATA_SIZE );
|
||||
@@ -266,7 +267,7 @@ LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components)
|
||||
}
|
||||
|
||||
LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components)
|
||||
: LLImageBase()
|
||||
: LLImageBase(), mCacheEntries(0)
|
||||
{
|
||||
mMemType = LLMemType::MTYPE_IMAGERAW;
|
||||
if(allocateDataSize(width, height, components) && data)
|
||||
@@ -277,7 +278,7 @@ LLImageRaw::LLImageRaw(U8 *data, U16 width, U16 height, S8 components)
|
||||
}
|
||||
|
||||
LLImageRaw::LLImageRaw(const std::string& filename, bool j2c_lowest_mip_only)
|
||||
: LLImageBase()
|
||||
: LLImageBase(), mCacheEntries(0)
|
||||
{
|
||||
createFromFile(filename, j2c_lowest_mip_only);
|
||||
}
|
||||
@@ -288,6 +289,7 @@ LLImageRaw::~LLImageRaw()
|
||||
// NOT LLImageRaw::deleteData()
|
||||
deleteData();
|
||||
--sRawImageCount;
|
||||
setInCache(false);
|
||||
}
|
||||
|
||||
// virtual
|
||||
|
||||
@@ -243,6 +243,24 @@ protected:
|
||||
public:
|
||||
static S32 sGlobalRawMemory;
|
||||
static S32 sRawImageCount;
|
||||
|
||||
static S32 sRawImageCachedCount;
|
||||
S32 mCacheEntries;
|
||||
void setInCache(bool in_cache)
|
||||
{
|
||||
if(in_cache)
|
||||
{
|
||||
if(!mCacheEntries)
|
||||
sRawImageCachedCount++;
|
||||
mCacheEntries++;
|
||||
}
|
||||
else if(mCacheEntries)
|
||||
{
|
||||
mCacheEntries--;
|
||||
if(!mCacheEntries)
|
||||
sRawImageCachedCount--;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Compressed representation of image.
|
||||
|
||||
@@ -131,6 +131,7 @@ BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time)
|
||||
if (! pngWrapper.writePng(raw_image, getData()))
|
||||
{
|
||||
setLastError(pngWrapper.getErrorMessage());
|
||||
deleteData();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -138,6 +139,7 @@ BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time)
|
||||
if(!reallocateData(pngWrapper.getFinalSize())) //Shrink. Returns NULL on failure.
|
||||
{
|
||||
setLastError("LLImagePNG::encode failed reallocateData");
|
||||
deleteData();
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
@@ -496,14 +496,14 @@ void LLGLTexMemBar::draw()
|
||||
#endif
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
text = llformat("Textures: %d Fetch: %d(%d) Pkts:%d(%d) Cache R/W: %d/%d LFS:%d IW:%d RAW:%d HTP:%d DEC:%d CRE:%d",
|
||||
text = llformat("Textures: %d Fetch: %d(%d) Pkts:%d(%d) Cache R/W: %d/%d LFS:%d IW:%d RAW:%d(%d) HTP:%d DEC:%d CRE:%d ",
|
||||
gTextureList.getNumImages(),
|
||||
LLAppViewer::getTextureFetch()->getNumRequests(), LLAppViewer::getTextureFetch()->getNumDeletes(),
|
||||
LLAppViewer::getTextureFetch()->mPacketCount, LLAppViewer::getTextureFetch()->mBadPacketCount,
|
||||
LLAppViewer::getTextureCache()->getNumReads(), LLAppViewer::getTextureCache()->getNumWrites(),
|
||||
LLLFSThread::sLocal->getPending(),
|
||||
LLAppViewer::getImageDecodeThread()->getPending(),
|
||||
LLImageRaw::sRawImageCount,
|
||||
LLImageRaw::sRawImageCount, LLImageRaw::sRawImageCachedCount,
|
||||
LLAppViewer::getTextureFetch()->getNumHTTPRequests(),
|
||||
LLAppViewer::getImageDecodeThread()->getPending(),
|
||||
gTextureList.mCreateTextureList.size());
|
||||
@@ -511,7 +511,7 @@ void LLGLTexMemBar::draw()
|
||||
LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, line_height*2,
|
||||
text_color, LLFontGL::LEFT, LLFontGL::TOP);
|
||||
|
||||
left = 650;
|
||||
left += LLFontGL::getFontMonospace()->getWidth(text);
|
||||
F32 bandwidth = LLAppViewer::getTextureFetch()->getTextureBandwidth();
|
||||
F32 max_bandwidth = gSavedSettings.getF32("ThrottleBandwidthKBPS");
|
||||
color = bandwidth > max_bandwidth ? LLColor4::red : bandwidth > max_bandwidth*.75f ? LLColor4::yellow : text_color;
|
||||
|
||||
@@ -1180,6 +1180,8 @@ void LLViewerFetchedTexture::init(bool firstinit)
|
||||
mForSculpt = FALSE ;
|
||||
mIsFetched = FALSE ;
|
||||
|
||||
if(!firstinit && mCachedRawImage.notNull())
|
||||
mCachedRawImage->setInCache(false);
|
||||
mCachedRawImage = NULL ;
|
||||
mCachedRawDiscardLevel = -1 ;
|
||||
mCachedRawImageReady = FALSE ;
|
||||
@@ -1228,6 +1230,8 @@ void LLViewerFetchedTexture::cleanup()
|
||||
|
||||
// Clean up image data
|
||||
destroyRawImage();
|
||||
if(mCachedRawImage.notNull())
|
||||
mCachedRawImage->setInCache(false);
|
||||
mCachedRawImage = NULL ;
|
||||
mCachedRawDiscardLevel = -1 ;
|
||||
mCachedRawImageReady = FALSE ;
|
||||
@@ -1354,6 +1358,8 @@ void LLViewerFetchedTexture::addToCreateTexture()
|
||||
//discard the cached raw image and the saved raw image
|
||||
mCachedRawImageReady = FALSE ;
|
||||
mCachedRawDiscardLevel = -1 ;
|
||||
if(mCachedRawImage.notNull())
|
||||
mCachedRawImage->setInCache(false);
|
||||
mCachedRawImage = NULL ;
|
||||
mSavedRawDiscardLevel = -1 ;
|
||||
mSavedRawImage = NULL ;
|
||||
@@ -2617,7 +2623,11 @@ void LLViewerFetchedTexture::setCachedRawImage(S32 discard_level, LLImageRaw* im
|
||||
{
|
||||
if(imageraw != mRawImage.get())
|
||||
{
|
||||
if(mCachedRawImage.notNull())
|
||||
mCachedRawImage->setInCache(false);
|
||||
mCachedRawImage = imageraw ;
|
||||
if(mCachedRawImage.notNull())
|
||||
mCachedRawImage->setInCache(true);
|
||||
mCachedRawDiscardLevel = discard_level ;
|
||||
mCachedRawImageReady = TRUE ;
|
||||
}
|
||||
@@ -2674,7 +2684,11 @@ void LLViewerFetchedTexture::setCachedRawImage()
|
||||
|
||||
mRawImage->scale(w >> i, h >> i) ;
|
||||
}
|
||||
if(mCachedRawImage.notNull())
|
||||
mCachedRawImage->setInCache(false);
|
||||
mCachedRawImage = mRawImage ;
|
||||
if(mCachedRawImage.notNull())
|
||||
mCachedRawImage->setInCache(true);
|
||||
mRawDiscardLevel += i ;
|
||||
mCachedRawDiscardLevel = mRawDiscardLevel ;
|
||||
}
|
||||
|
||||
@@ -495,6 +495,7 @@ private:
|
||||
|
||||
void saveRawImage() ;
|
||||
void setCachedRawImage() ;
|
||||
void setCachedRawImagePtr(LLImageRaw *pRawImage) ;
|
||||
|
||||
//for atlas
|
||||
/*void resetFaceAtlas() ;
|
||||
|
||||
Reference in New Issue
Block a user