diff options
author | Xiaohong Bao <bao@lindenlab.com> | 2011-12-05 16:28:13 -0700 |
---|---|---|
committer | Xiaohong Bao <bao@lindenlab.com> | 2011-12-05 16:28:13 -0700 |
commit | 01d68a9f1572fba971ace6944a91a85e7c379d1e (patch) | |
tree | 77a3a381d627d8483c1a5b4f463ac83b22a78386 /indra/newview | |
parent | c278f259c684d32a1da339fd4d0b0d4226916de0 (diff) |
call LLViewerTexture::isMemoryForTextureLow() less often and only for ATI cards.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llviewertexture.cpp | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index f4bbc2b067..addf1147f2 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -420,8 +420,17 @@ F32 texmem_middle_bound_scale = 0.925f; //static bool LLViewerTexture::isMemoryForTextureLow() { - const static S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB - const static S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB + const F32 WAIT_TIME = 1.0f ; //second + static LLFrameTimer timer ; + + if(timer.getElapsedTimeF32() < WAIT_TIME) //call this once per second. + { + return false; + } + timer.reset() ; + + const S32 MIN_FREE_TEXTURE_MEMORY = 5 ; //MB + const S32 MIN_FREE_MAIN_MEMORy = 100 ; //MB bool low_mem = false ; if (gGLManager.mHasATIMemInfo) @@ -433,6 +442,15 @@ bool LLViewerTexture::isMemoryForTextureLow() { low_mem = true ; } + + if(!low_mem) //check main memory, only works for windows. + { + LLMemory::updateMemoryInfo() ; + if(LLMemory::getAvailableMemKB() / 1024 < MIN_FREE_MAIN_MEMORy) + { + low_mem = true ; + } + } } #if 0 //ignore nVidia cards else if (gGLManager.mHasNVXMemInfo) @@ -445,16 +463,7 @@ bool LLViewerTexture::isMemoryForTextureLow() low_mem = true ; } } -#endif - - if(!low_mem) //check main memory, only works for windows. - { - LLMemory::updateMemoryInfo() ; - if(LLMemory::getAvailableMemKB() / 1024 < MIN_FREE_MAIN_MEMORy) - { - low_mem = true ; - } - } +#endif return low_mem ; } |