From 203ef2f8d89a593ffe3af2f9556eebffd8d535a5 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 9 Jan 2025 17:15:15 +0200 Subject: #3364 Decrement bias only if there is 10prcnt free space Instead of when there is any space. --- indra/newview/llviewertexture.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 36b6787ace..26eaa3c5bb 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -556,12 +556,13 @@ void LLViewerTexture::updateClass() // don't execute above until the slam to 1.5 has a chance to take effect sEvaluationTimer.reset(); - // lower discard bias over time when free memory is available - if (sDesiredDiscardBias > 1.f && over_pct < 0.f) + // lower discard bias over time when at least 10% of budget is free + const F32 FREE_PERCENTAGE_TRESHOLD = -0.1f; + if (sDesiredDiscardBias > 1.f && over_pct < FREE_PERCENTAGE_TRESHOLD) { static LLCachedControl high_mem_discard_decrement(gSavedSettings, "RenderHighMemMinDiscardDecrement", .1f); - F32 decrement = high_mem_discard_decrement - llmin(over_pct, 0.f); + F32 decrement = high_mem_discard_decrement - llmin(over_pct - FREE_PERCENTAGE_TRESHOLD, 0.f); sDesiredDiscardBias -= decrement * gFrameIntervalSeconds; } } -- cgit v1.2.3 From 6dc819e22aaf35054764a57dc51bb0ed629c6703 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 15 Jan 2025 18:28:09 +0200 Subject: #3364 Fix update rate being stuck high due to bias if bias stays unchanged at 4.f, there is no reason to keep refreshing at high rate. --- indra/newview/llviewertexture.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 26eaa3c5bb..271460f2cc 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -87,6 +87,7 @@ S32 LLViewerTexture::sRawCount = 0; S32 LLViewerTexture::sAuxCount = 0; LLFrameTimer LLViewerTexture::sEvaluationTimer; F32 LLViewerTexture::sDesiredDiscardBias = 0.f; +U32 LLViewerTexture::sBiasTexturesUpdated = 0; S32 LLViewerTexture::sMaxSculptRez = 128; //max sculpt image size constexpr S32 MAX_CACHED_RAW_IMAGE_AREA = 64 * 64; @@ -518,6 +519,7 @@ 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; @@ -604,6 +606,12 @@ void LLViewerTexture::updateClass() } sDesiredDiscardBias = llclamp(sDesiredDiscardBias, 1.f, 4.f); + if (discard_bias != sDesiredDiscardBias) + { + // bias changed, reset texture update counter to + // let updates happen at an increased rate. + sBiasTexturesUpdated = 0; + } LLViewerTexture::sFreezeImageUpdates = false; } -- cgit v1.2.3 From c85880aca971493ea5f7c80b8f152e0e8d00813c Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 13 Jan 2025 17:54:02 +0200 Subject: #3371 Texture resolution cap --- indra/newview/llviewertexture.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 271460f2cc..3f30a42b0e 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1694,6 +1694,16 @@ void LLViewerFetchedTexture::processTextureStats() static LLCachedControl textures_fullres(gSavedSettings,"TextureLoadFullRes", false); + if (mBoostLevel < LLGLTexture::BOOST_HIGH) + { + // restrict texture resolution to download based on RenderMaxTextureResolution + static LLCachedControl max_texture_resolution(gSavedSettings, "RenderMaxTextureResolution", 2048); + // sanity clamp debug setting to avoid settings hack shenanigans + F32 tex_res = (F32)llclamp((S32)max_texture_resolution, 512, MAX_IMAGE_SIZE_DEFAULT); + tex_res *= tex_res; + mMaxVirtualSize = llmin(mMaxVirtualSize, tex_res); + } + if (textures_fullres) { mDesiredDiscardLevel = 0; @@ -2948,10 +2958,12 @@ void LLViewerLODTexture::processTextureStats() static LLCachedControl textures_fullres(gSavedSettings,"TextureLoadFullRes", false); - { // restrict texture resolution to download based on RenderMaxTextureResolution + if (mBoostLevel < LLGLTexture::BOOST_HIGH) + { + // restrict texture resolution to download based on RenderMaxTextureResolution static LLCachedControl max_texture_resolution(gSavedSettings, "RenderMaxTextureResolution", 2048); // sanity clamp debug setting to avoid settings hack shenanigans - F32 tex_res = (F32)llclamp((S32)max_texture_resolution, 512, 2048); + F32 tex_res = (F32)llclamp((S32)max_texture_resolution, 512, MAX_IMAGE_SIZE_DEFAULT); tex_res *= tex_res; mMaxVirtualSize = llmin(mMaxVirtualSize, tex_res); } -- cgit v1.2.3 From 9159922bdf47093ba2330ce38ea69562fbbaedb1 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 17 Jan 2025 22:04:39 +0200 Subject: #3371 Texture resolution cap #2 --- indra/newview/llviewertexture.cpp | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 3f30a42b0e..2eaadd9e71 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -108,12 +108,6 @@ LLViewerTexture::EDebugTexels LLViewerTexture::sDebugTexelsMode = LLViewerTextur const F64 log_2 = log(2.0); -#if ADDRESS_SIZE == 32 -const U32 DESIRED_NORMAL_TEXTURE_SIZE = (U32)LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT / 2; -#else -const U32 DESIRED_NORMAL_TEXTURE_SIZE = (U32)LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT; -#endif - //---------------------------------------------------------------------------------------------- //namespace: LLViewerTextureAccess //---------------------------------------------------------------------------------------------- @@ -1694,14 +1688,14 @@ void LLViewerFetchedTexture::processTextureStats() static LLCachedControl textures_fullres(gSavedSettings,"TextureLoadFullRes", false); + U32 max_tex_res = MAX_IMAGE_SIZE_DEFAULT; if (mBoostLevel < LLGLTexture::BOOST_HIGH) { // restrict texture resolution to download based on RenderMaxTextureResolution static LLCachedControl max_texture_resolution(gSavedSettings, "RenderMaxTextureResolution", 2048); // sanity clamp debug setting to avoid settings hack shenanigans - F32 tex_res = (F32)llclamp((S32)max_texture_resolution, 512, MAX_IMAGE_SIZE_DEFAULT); - tex_res *= tex_res; - mMaxVirtualSize = llmin(mMaxVirtualSize, tex_res); + max_tex_res = (U32)llclamp((U32)max_texture_resolution, 512, MAX_IMAGE_SIZE_DEFAULT); + mMaxVirtualSize = llmin(mMaxVirtualSize, (F32)(max_tex_res * max_tex_res)); } if (textures_fullres) @@ -1725,10 +1719,9 @@ void LLViewerFetchedTexture::processTextureStats() } else { - U32 desired_size = MAX_IMAGE_SIZE_DEFAULT; // MAX_IMAGE_SIZE_DEFAULT = 2048 and max size ever is 4096 if(!mKnownDrawWidth || !mKnownDrawHeight || (S32)mFullWidth <= mKnownDrawWidth || (S32)mFullHeight <= mKnownDrawHeight) { - if (mFullWidth > desired_size || mFullHeight > desired_size) + if (mFullWidth > max_tex_res || mFullHeight > max_tex_res) { mDesiredDiscardLevel = 1; } @@ -2958,14 +2951,14 @@ void LLViewerLODTexture::processTextureStats() static LLCachedControl textures_fullres(gSavedSettings,"TextureLoadFullRes", false); + F32 max_tex_res = MAX_IMAGE_SIZE_DEFAULT; if (mBoostLevel < LLGLTexture::BOOST_HIGH) { // restrict texture resolution to download based on RenderMaxTextureResolution static LLCachedControl max_texture_resolution(gSavedSettings, "RenderMaxTextureResolution", 2048); // sanity clamp debug setting to avoid settings hack shenanigans - F32 tex_res = (F32)llclamp((S32)max_texture_resolution, 512, MAX_IMAGE_SIZE_DEFAULT); - tex_res *= tex_res; - mMaxVirtualSize = llmin(mMaxVirtualSize, tex_res); + max_tex_res = (F32)llclamp((S32)max_texture_resolution, 512, MAX_IMAGE_SIZE_DEFAULT); + mMaxVirtualSize = llmin(mMaxVirtualSize, max_tex_res * max_tex_res); } if (textures_fullres) @@ -3021,12 +3014,7 @@ void LLViewerLODTexture::processTextureStats() discard_level = floorf(discard_level); F32 min_discard = 0.f; - U32 desired_size = MAX_IMAGE_SIZE_DEFAULT; // MAX_IMAGE_SIZE_DEFAULT = 2048 and max size ever is 4096 - if (mBoostLevel <= LLGLTexture::BOOST_SCULPTED) - { - desired_size = DESIRED_NORMAL_TEXTURE_SIZE; - } - if (mFullWidth > desired_size || mFullHeight > desired_size) + if (mFullWidth > max_tex_res || mFullHeight > max_tex_res) min_discard = 1.f; discard_level = llclamp(discard_level, min_discard, (F32)MAX_DISCARD_LEVEL); -- cgit v1.2.3 From 5af750a1304f795fae4d6e8336defe1eff3f3659 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 21 Jan 2025 23:08:00 +0200 Subject: #3450 Crash at LLViewerMediaTexture::setPlaying --- indra/newview/llviewertexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 2eaadd9e71..4996ae1c96 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3553,7 +3553,7 @@ void LLViewerMediaTexture::setPlaying(bool playing) { LLFace* facep = *iter; const LLTextureEntry* te = facep->getTextureEntry(); - if (te->getGLTFMaterial()) + if (te && te->getGLTFMaterial()) { // PBR material, switch emissive and basecolor switchTexture(LLRender::EMISSIVE_MAP, *iter); -- cgit v1.2.3 From 783365d3310b65985b52ec7a1bfb375f6eaef7bb Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 23 Jan 2025 18:53:14 +0200 Subject: Small cleanup --- indra/newview/llviewertexture.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 4996ae1c96..1084fb91da 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -2925,8 +2925,6 @@ LLViewerLODTexture::LLViewerLODTexture(const std::string& url, FTType f_type, co void LLViewerLODTexture::init(bool firstinit) { mTexelsPerImage = 64*64; - mDiscardVirtualSize = 0.f; - mCalculatedDiscardLevel = -1.f; } //virtual @@ -3007,8 +3005,6 @@ void LLViewerLODTexture::processTextureStats() { // Calculate the required scale factor of the image using pixels per texel discard_level = (F32)(log(mTexelsPerImage / mMaxVirtualSize) / log_4); - mDiscardVirtualSize = mMaxVirtualSize; - mCalculatedDiscardLevel = discard_level; } discard_level = floorf(discard_level); -- cgit v1.2.3 From 81a2813bf50c7a75acaa48c7398ce926784300c6 Mon Sep 17 00:00:00 2001 From: Rye Date: Mon, 3 Feb 2025 14:43:56 -0500 Subject: Fix media failing to function on PBR materials (#3445) --- indra/newview/llviewertexture.cpp | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'indra/newview/llviewertexture.cpp') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 1084fb91da..609ad38e96 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3548,18 +3548,7 @@ void LLViewerMediaTexture::setPlaying(bool playing) for(std::list< LLFace* >::iterator iter = mMediaFaceList.begin(); iter!= mMediaFaceList.end(); ++iter) { LLFace* facep = *iter; - const LLTextureEntry* te = facep->getTextureEntry(); - if (te && te->getGLTFMaterial()) - { - // PBR material, switch emissive and basecolor - switchTexture(LLRender::EMISSIVE_MAP, *iter); - switchTexture(LLRender::BASECOLOR_MAP, *iter); - } - else - { - // blinn-phong material, switch diffuse map only - switchTexture(LLRender::DIFFUSE_MAP, *iter); - } + switchTexture(LLRender::DIFFUSE_MAP, facep); } } else //stop playing this media -- cgit v1.2.3