diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2025-03-12 15:59:48 +0200 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-03-21 09:44:51 +0200 |
commit | 18e06771e56b77d4a1bb875734354612122d05c5 (patch) | |
tree | dd97b98bb35de041bd73d0272deae7c25e8edc6d /indra/newview/llviewertexture.cpp | |
parent | d2dd881a5c840b5132396d6e8353b38b79d69e23 (diff) |
#3364 Fix a case of excessive texture updates
when bias fluctuates a bit.
Make bias' effect a bit more gradual.
Diffstat (limited to 'indra/newview/llviewertexture.cpp')
-rw-r--r-- | indra/newview/llviewertexture.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index a0723db479..0782192858 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -519,7 +519,6 @@ void LLViewerTexture::updateClass() bool is_sys_low = isSystemMemoryLow(); bool is_low = is_sys_low || over_pct > 0.f; - F32 discard_bias = sDesiredDiscardBias; static bool was_low = false; static bool was_sys_low = false; @@ -571,6 +570,7 @@ void LLViewerTexture::updateClass() // set to max discard bias if the window has been backgrounded for a while static F32 last_desired_discard_bias = 1.f; + static F32 last_texture_update_count_bias = 1.f; static bool was_backgrounded = false; static LLFrameTimer backgrounded_timer; static LLCachedControl<F32> minimized_discard_time(gSavedSettings, "TextureDiscardMinimizedTime", 1.f); @@ -606,12 +606,21 @@ void LLViewerTexture::updateClass() } sDesiredDiscardBias = llclamp(sDesiredDiscardBias, 1.f, 4.f); - if (discard_bias != sDesiredDiscardBias) + if (last_texture_update_count_bias < sDesiredDiscardBias) { - // bias changed, reset texture update counter to + // bias increased, reset texture update counter to // let updates happen at an increased rate. + last_texture_update_count_bias = sDesiredDiscardBias; sBiasTexturesUpdated = 0; } + else if (last_texture_update_count_bias > sDesiredDiscardBias + 0.1f) + { + // bias decreased, 0.1f is there to filter out small fluctuations + // and not reset sBiasTexturesUpdated too often. + // Bias jumps to 1.5 at low memory, so getting stuck at 1.1 is not + // a problem. + last_texture_update_count_bias = sDesiredDiscardBias; + } LLViewerTexture::sFreezeImageUpdates = false; } |