summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan "Geenz" Goodman <geenz@lindenlab.com>2025-03-05 19:06:01 -0500
committerGitHub <noreply@github.com>2025-03-05 19:06:01 -0500
commitf5a25a9d6a94e7899ddb04199e5c4fd2d56228d1 (patch)
tree64a146ad7a55bd51a5067a79e63739e4d3112777
parent85c77ee9102d4f70cc566f96b4c2f0b1924234da (diff)
Add RenderTextureVRAMDivisor (#3648)
#3647 Add texture VRAM use divisor.
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/llviewertexture.cpp8
2 files changed, 18 insertions, 1 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 6f2a9932bc..594f40e5a1 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -7794,6 +7794,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>RenderTextureVRAMDivisor</key>
+ <map>
+ <key>Comment</key>
+ <string>Divisor for maximum amount of VRAM the viewer will use for textures. 1 = all the VRAM. Used in conjunction with RenderMaxVRAMBudget.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>U32</string>
+ <key>Value</key>
+ <integer>2</integer>
+ </map>
<key>RenderMinFreeMainMemoryThreshold</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 609ad38e96..a0723db479 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -489,7 +489,12 @@ void LLViewerTexture::updateClass()
}
LLViewerMediaTexture::updateClass();
-
+ // This is a divisor used to determine how much VRAM from our overall VRAM budget to use.
+ // This is **cumulative** on whatever the detected or manually set VRAM budget is.
+ // If we detect 2048MB of VRAM, this will, by default, only use 1024.
+ // If you set 1024MB of VRAM, this will, by default, use 512.
+ // -Geenz 2025-03-03
+ static LLCachedControl<U32> tex_vram_divisor(gSavedSettings, "RenderTextureVRAMDivisor", 2);
static LLCachedControl<U32> max_vram_budget(gSavedSettings, "RenderMaxVRAMBudget", 0);
F64 texture_bytes_alloc = LLImageGL::getTextureBytesAllocated() / 1024.0 / 512.0;
@@ -500,6 +505,7 @@ void LLViewerTexture::updateClass()
F32 used = (F32)ll_round(texture_bytes_alloc + vertex_bytes_alloc);
F32 budget = max_vram_budget == 0 ? (F32)gGLManager.mVRAM : (F32)max_vram_budget;
+ budget /= tex_vram_divisor;
// Try to leave at least half a GB for everyone else and for bias,
// but keep at least 768MB for ourselves