summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturecache.cpp
diff options
context:
space:
mode:
authorNyx Linden <nyx@lindenlab.com>2013-08-16 19:31:16 -0400
committerNyx Linden <nyx@lindenlab.com>2013-08-16 19:31:16 -0400
commit5ae117aff6bfbc3c07876146ca270129dd91a047 (patch)
tree462f491cc055aa296b9da0041a322cd9512c045b /indra/newview/lltexturecache.cpp
parent8abd6ed6b8c294ec6bfca59929dbcc71cd65c3a3 (diff)
parent32b8d398eca5eaa4ca99aa48839ad64d97954cae (diff)
merge with viewer-release
Diffstat (limited to 'indra/newview/lltexturecache.cpp')
-rwxr-xr-xindra/newview/lltexturecache.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 305f6fca0f..36a7aeb590 100755
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -568,8 +568,11 @@ bool LLTextureCacheRemoteWorker::doWrite()
idx = mCache->setHeaderCacheEntry(mID, entry, mImageSize, mDataSize); // create the new entry.
if(idx >= 0)
{
- //write to the fast cache.
- llassert_always(mCache->writeToFastCache(idx, mRawImage, mRawDiscardLevel));
+ // (almost always) write to the fast cache.
+ if (mRawImage->getDataSize())
+ {
+ llassert_always(mCache->writeToFastCache(idx, mRawImage, mRawDiscardLevel));
+ }
}
}
else
@@ -1895,10 +1898,17 @@ LLPointer<LLImageRaw> LLTextureCache::readFromFastCache(const LLUUID& id, S32& d
bool LLTextureCache::writeToFastCache(S32 id, LLPointer<LLImageRaw> raw, S32 discardlevel)
{
//rescale image if needed
+ if (raw.isNull() || !raw->getData())
+ {
+ llerrs << "Attempted to write NULL raw image to fastcache" << llendl;
+ return false;
+ }
+
S32 w, h, c;
w = raw->getWidth();
h = raw->getHeight();
c = raw->getComponents();
+
S32 i = 0 ;
while(((w >> i) * (h >> i) * c) > TEXTURE_FAST_CACHE_ENTRY_SIZE - TEXTURE_FAST_CACHE_ENTRY_OVERHEAD)