diff options
Diffstat (limited to 'indra/newview/lltexturecache.cpp')
-rwxr-xr-x | indra/newview/lltexturecache.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index f03cc22949..ee3b605cb0 100755 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -568,10 +568,13 @@ bool LLTextureCacheRemoteWorker::doWrite() idx = mCache->setHeaderCacheEntry(mID, entry, mImageSize, mDataSize); // create the new entry. if(idx >= 0) { - //write to the fast cache. + // (almost always) write to the fast cache. + if (mRawImage->getDataSize()) + { llassert_always(mCache->writeToFastCache(idx, mRawImage, mRawDiscardLevel)); } } + } else { alreadyCached = mCache->updateEntry(idx, entry, mImageSize, mDataSize); // update the existing entry. @@ -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) |