From e29f811d56a283a32b490bec5bdcd1b0293a8986 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 1 Sep 2010 13:40:10 -0600 Subject: code for DEV-52939: viewer's object geometry cache files are not limited in number, and can also be incorrectly cleared with the VFS cache. reviewed by andrew. --- indra/newview/lltexturecache.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'indra/newview/lltexturecache.cpp') diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 2fd0a22f80..6a213309a0 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -927,7 +927,7 @@ void LLTextureCache::setReadOnly(BOOL read_only) } //called in the main thread. -S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL disable_texture_cache) +S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL texture_cache_mismatch) { llassert_always(getPending() == 0) ; //should not start accessing the texture cache before initialized. @@ -942,20 +942,23 @@ S64 LLTextureCache::initCache(ELLPath location, S64 max_size, BOOL disable_textu sCacheMaxTexturesSize = max_size; max_size -= sCacheMaxTexturesSize; - if(disable_texture_cache) //the texture cache is disabled - { - llinfos << "The texture cache is disabled!" << llendl ; - setReadOnly(TRUE) ; - purgeAllTextures(true); - - return max_size ; - } - LL_INFOS("TextureCache") << "Headers: " << sCacheMaxEntries << " Textures size: " << sCacheMaxTexturesSize/(1024*1024) << " MB" << LL_ENDL; setDirNames(location); + if(texture_cache_mismatch) + { + //if readonly, disable the texture cache, + //otherwise wipe out the texture cache. + purgeAllTextures(true); + + if(mReadOnly) + { + return max_size ; + } + } + if (!mReadOnly) { LLFile::mkdir(mTexturesDirName); -- cgit v1.2.3