diff options
author | Dave Parks <davep@lindenlab.com> | 2024-09-04 11:34:44 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-04 11:34:44 -0500 |
commit | cb9f3dcfe9a55789b757bf5a7d9af3d93710c20f (patch) | |
tree | 39ae29d9bf804618466c754cda71518d2b86c9a2 /indra/newview/llviewertexture.cpp | |
parent | 891219dcef44583070e7487d0b6a4e57ad954667 (diff) |
#2482 Low end NVIDIA compatibility pass (#2486)
- Use GL_NVX_gpu_memory_info when available
- Disable transparent water on Mid+ and lower
- Adjust GPU benchmark to better tell the truth
- Texture bias tune up
- viewer-private/#277 - Report foreground_time in viewer stats
Diffstat (limited to 'indra/newview/llviewertexture.cpp')
-rw-r--r-- | indra/newview/llviewertexture.cpp | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 452d6f2c04..15b4a3aab3 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -511,44 +511,52 @@ void LLViewerTexture::updateClass() F32 over_pct = (used - target) / target; - bool is_low = over_pct > 0.f; + bool is_sys_low = isSystemMemoryLow(); + bool is_low = is_sys_low || over_pct > 0.f; - if (isSystemMemoryLow()) + static bool was_low = false; + static bool was_sys_low = false; + + if (is_low && !was_low) + { + // slam to 1.5 bias the moment we hit low memory (discards off screen textures immediately) + sDesiredDiscardBias = llmax(sDesiredDiscardBias, 1.5f); + + if (is_sys_low) + { // if we're low on system memory, emergency purge off screen textures to avoid a death spiral + LL_WARNS() << "Low system memory detected, emergency downrezzing off screen textures" << LL_ENDL; + for (auto& image : gTextureList) + { + gTextureList.updateImageDecodePriority(image, false /*will modify gTextureList otherwise!*/); + } + } + } + + was_low = is_low; + was_sys_low = is_sys_low; + + if (is_low) { - is_low = true; - // System RAM is low -> ramp up discard bias over time to free memory + // ramp up discard bias over time to free memory if (sEvaluationTimer.getElapsedTimeF32() > MEMORY_CHECK_WAIT_TIME) { static LLCachedControl<F32> low_mem_min_discard_increment(gSavedSettings, "RenderLowMemMinDiscardIncrement", .1f); - sDesiredDiscardBias += (F32) low_mem_min_discard_increment * (F32) gFrameIntervalSeconds; + sDesiredDiscardBias += (F32)low_mem_min_discard_increment * (F32)gFrameIntervalSeconds; sEvaluationTimer.reset(); } } else { - sDesiredDiscardBias = llmax(sDesiredDiscardBias, 1.f + over_pct); + // don't execute above until the slam to 1.5 has a chance to take effect + sEvaluationTimer.reset(); + // lower discard bias over time when free memory is available if (sDesiredDiscardBias > 1.f && over_pct < 0.f) { sDesiredDiscardBias -= gFrameIntervalSeconds * 0.01f; } } - static bool was_low = false; - if (is_low && !was_low) - { - LL_WARNS() << "Low system memory detected, emergency downrezzing off screen textures" << LL_ENDL; - sDesiredDiscardBias = llmax(sDesiredDiscardBias, 1.5f); - - for (auto& image : gTextureList) - { - gTextureList.updateImageDecodePriority(image, false /*will modify gTextureList otherwise!*/); - } - } - - was_low = is_low; - - // set to max discard bias if the window has been backgrounded for a while static bool was_backgrounded = false; static LLFrameTimer backgrounded_timer; |