summaryrefslogtreecommitdiff
path: root/indra/newview/llviewertexture.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-10-20 23:20:58 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-10-25 13:53:11 +0300
commitfa5aba2b67a029c7415c48270c8c84cd35e73a24 (patch)
tree19cddf89740707b909041e84cdf7a0392d6a4d3a /indra/newview/llviewertexture.cpp
parent72ce0248f1669e3e172e38beeab96147d7eaea3b (diff)
viewer#2875 Proportionally agressive vram cleanup
Diffstat (limited to 'indra/newview/llviewertexture.cpp')
-rw-r--r--indra/newview/llviewertexture.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 0f9c65893d..f1c0a4f0fc 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -505,8 +505,12 @@ void LLViewerTexture::updateClass()
F32 budget = max_vram_budget == 0 ? (F32)gGLManager.mVRAM : (F32)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, MIN_VRAM_BUDGET);
+ // Try to leave at least half a GB for everyone else and for bias,
+ // but keep at least 768MB for ourselves
+ // Viewer can 'overshoot' target when scene changes, if viewer goes over budget it
+ // can negatively impact performance, so leave 20% of a breathing room for
+ // 'bias' calculation to kick in.
+ F32 target = llmax(llmin(budget - 512.f, budget * 0.8f), MIN_VRAM_BUDGET);
sFreeVRAMMegabytes = target - used;
F32 over_pct = (used - target) / target;
@@ -522,7 +526,7 @@ void LLViewerTexture::updateClass()
// 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 (is_sys_low || over_pct > 2.f)
{ // 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)