diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/lltextureview.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llviewertexture.cpp | 11 | ||||
-rw-r--r-- | indra/newview/llviewertexture.h | 3 |
3 files changed, 14 insertions, 3 deletions
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp index 62703e3499..18c42e9c22 100644 --- a/indra/newview/lltextureview.cpp +++ b/indra/newview/lltextureview.cpp @@ -529,11 +529,12 @@ void LLGLTexMemBar::draw() U32 texFetchLatMed = U32(recording.getMean(LLTextureFetch::sTexFetchLatency).value() * 1000.0f); U32 texFetchLatMax = U32(recording.getMax(LLTextureFetch::sTexFetchLatency).value() * 1000.0f); - text = llformat("GL Free: %d MB Sys Free: %d MB FBO: %d MB Bias: %.2f Cache: %.1f/%.1f MB", + text = llformat("GL Free: %d MB Sys Free: %d MB FBO: %d MB Bias: %.2f(%d MB) Cache: %.1f/%.1f MB", gViewerWindow->getWindow()->getAvailableVRAMMegabytes(), LLMemory::getAvailableMemKB()/1024, LLRenderTarget::sBytesAllocated/(1024*1024), discard_bias, + (S32)LLViewerTexture::sFreeVRAMMegabytes, cache_usage, cache_max_usage); //, cache_entries, cache_max_entries diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index c4a681f2b7..89b7b3ba0d 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -100,6 +100,9 @@ U32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA; bool LLViewerTexture::sFreezeImageUpdates = false; F32 LLViewerTexture::sCurrentTime = 0.0f; +constexpr F32 MIN_VRAM_BUDGET = 768.f; +F32 LLViewerTexture::sFreeVRAMMegabytes = MIN_VRAM_BUDGET; + LLViewerTexture::EDebugTexels LLViewerTexture::sDebugTexelsMode = LLViewerTexture::DEBUG_TEXELS_OFF; const F64 log_2 = log(2.0); @@ -509,7 +512,10 @@ void LLViewerTexture::getGPUMemoryForTextures(S32Megabytes &gpu, S32Megabytes &p timer.reset(); { - gpu_res = (S32Megabytes)gViewerWindow->getWindow()->getAvailableVRAMMegabytes(); + // For purposes of texture memory need to check both, actual free + // memory and estimated free texture memory from bias calculations + U32 free_memory = llmin(gViewerWindow->getWindow()->getAvailableVRAMMegabytes(), (U32)sFreeVRAMMegabytes); + gpu_res = (S32Megabytes)free_memory; //check main memory, only works for windows and macos. LLMemory::updateMemoryInfo(); @@ -546,7 +552,8 @@ void LLViewerTexture::updateClass() F32 budget = max_vram_budget == 0 ? gGLManager.mVRAM : max_vram_budget; // try to leave half a GB for everyone else, but keep at least 768MB for ourselves - F32 target = llmax(budget - 512.f, 768.f); + F32 target = llmax(budget - 512.f, MIN_VRAM_BUDGET); + sFreeVRAMMegabytes = target - used; F32 over_pct = llmax((used-target) / target, 0.f); sDesiredDiscardBias = llmax(sDesiredDiscardBias, 1.f + over_pct); diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 35fb0a2237..b26f768396 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -228,6 +228,9 @@ public: static bool sFreezeImageUpdates; static F32 sCurrentTime ; + // estimated free memory for textures, by bias calculation + static F32 sFreeVRAMMegabytes; + enum EDebugTexels { DEBUG_TEXELS_OFF, |