From 97f8dfaca2a60e228b84aedbf71620f0c000412c Mon Sep 17 00:00:00 2001 From: "Jonathan \"Geenz\" Goodman" Date: Thu, 14 May 2026 22:36:43 -0400 Subject: Add a background discard offset. --- indra/newview/app_settings/settings.xml | 12 ++++++++++++ indra/newview/llviewertexture.cpp | 11 ++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0f1b704dc9..e9d91b7add 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11909,6 +11909,18 @@ Value 0.011 + TextureBackgroundDiscardOffset + + Comment + Backgrounded textures will only discard up to (dim_max - offset). e.g. a 2048 texture (dim_max 11) with offset 2 caps the background floor at discard 9. 0 disables the cap (background can drive to max discard). + Persist + 1 + Type + S32 + Value + 2 + + TextureDistanceDiscardPower Comment diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 79439b4d58..1e8951926e 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3204,7 +3204,16 @@ void LLViewerLODTexture::processTextureStats() combined = llmax(combined, mStalenessFactor); if (!isAgentAvatarBoost(mBoostLevel)) { - combined = llmax(combined, sBackgroundFactor); + // Background floor capped at (dim_max - offset) so we can + // keep some baseline quality while backgrounded. + static LLCachedControl bg_offset(gSavedSettings, "TextureBackgroundDiscardOffset", 2); + F32 bg = sBackgroundFactor; + if ((S32)bg_offset > 0 && dim_max_for_image > 0.f) + { + F32 cap = llmax(dim_max_for_image - (F32)(S32)bg_offset, 0.f) / dim_max_for_image; + bg = llmin(bg, cap); + } + combined = llmax(combined, bg); } // VRAM pressure: pow(combined, 1 - factor) bends the curve -- cgit v1.3