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 | |
parent | d2dd881a5c840b5132396d6e8353b38b79d69e23 (diff) |
#3364 Fix a case of excessive texture updates
when bias fluctuates a bit.
Make bias' effect a bit more gradual.
-rw-r--r-- | indra/newview/lldrawpooltree.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llviewertexture.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llviewertexturelist.cpp | 3 |
3 files changed, 17 insertions, 6 deletions
diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 6efd503574..26ef190fbb 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -108,8 +108,9 @@ void LLDrawPoolTree::beginShadowPass(S32 pass) { LL_PROFILE_ZONE_SCOPED; - glPolygonOffset(gSavedSettings.getF32("RenderDeferredTreeShadowOffset"), - gSavedSettings.getF32("RenderDeferredTreeShadowBias")); + static LLCachedControl<F32> shadow_offset(gSavedSettings, "RenderDeferredTreeShadowOffset"); + static LLCachedControl<F32> shadow_bias(gSavedSettings, "RenderDeferredTreeShadowBias"); + glPolygonOffset(shadow_offset(), shadow_bias()); LLEnvironment& environment = LLEnvironment::instance(); 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; } diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index ae723b4068..db530a3943 100644 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -958,7 +958,8 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag vsize /= min_scale; // apply bias to offscreen faces all the time, but only to onscreen faces when bias is large - if (!face->mInFrustum || LLViewerTexture::sDesiredDiscardBias > 2.f) + // use mImportanceToCamera to make bias switch a bit more gradual + if (!face->mInFrustum || LLViewerTexture::sDesiredDiscardBias > 1.9f + face->mImportanceToCamera / 2.f) { vsize /= bias; } |