From f5a25a9d6a94e7899ddb04199e5c4fd2d56228d1 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Geenz\" Goodman" Date: Wed, 5 Mar 2025 19:06:01 -0500 Subject: Add RenderTextureVRAMDivisor (#3648) #3647 Add texture VRAM use divisor. --- indra/newview/app_settings/settings.xml | 11 +++++++++++ indra/newview/llviewertexture.cpp | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) 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 @@ Value 0 + RenderTextureVRAMDivisor + + Comment + Divisor for maximum amount of VRAM the viewer will use for textures. 1 = all the VRAM. Used in conjunction with RenderMaxVRAMBudget. + Persist + 1 + Type + U32 + Value + 2 + RenderMinFreeMainMemoryThreshold Comment 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 tex_vram_divisor(gSavedSettings, "RenderTextureVRAMDivisor", 2); static LLCachedControl 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 -- cgit v1.2.3