From a12c4e4857953c46b1d83f12bcfde072088901eb Mon Sep 17 00:00:00 2001 From: minerjr Date: Tue, 15 Apr 2025 22:44:10 -0300 Subject: [PATCH] FIRE-35361 RenderMaxTextureResolution caps texture resolution lower than intended Issue was caused by comparison of mMaxVirtualSize when it equaled the height X width exactly, it would skip down 1 discard level. Also, fixed up loop to go from min_discard to < MAX_DISCARD_LEVEL and if now found, sets discard_level to MAX_DISCARD_LEVEL. This prevents the need to do the llclamp farther down. --- indra/newview/llviewertexture.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index bba0895e08..0a460152d5 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -3142,25 +3142,25 @@ void LLViewerLODTexture::processTextureStats() F32 min_discard = 0.f; */ + // Use a S32 instead of a float + S32 min_discard = 0; + if (mFullWidth > max_tex_res || mFullHeight > max_tex_res) + min_discard = 1; + // Use a S32 value for the discard level - S32 discard_level = 0; - // Find the best discard that covers the entire mMaxVirtualSize of the on screen texture - for (; discard_level <= MAX_DISCARD_LEVEL; discard_level++) + S32 discard_level = min_discard; + // Find the best discard that covers the entire mMaxVirtualSize of the on screen texture (Use MAX_DISCARD_LEVEL as a max discard instead of MAX_DISCARD_LEVEL+1) + for (; discard_level < MAX_DISCARD_LEVEL; discard_level++) // [FIRE-35361] RenderMaxTextureResolution caps texture resolution lower than intended { - // If the max virtual size is greater then the current discard level, then break out of the loop and use the current discard level - if (mMaxVirtualSize > getWidth(discard_level) * getHeight(discard_level)) + // If the max virtual size is greater then or equal to the current discard level, then break out of the loop and use the current discard level + if (mMaxVirtualSize >= getWidth(discard_level) * getHeight(discard_level)) // [FIRE-35361] RenderMaxTextureResolution caps texture resolution lower than intended { break; } } - // Use a S32 instead of a float - S32 min_discard = 0; - if (mFullWidth > max_tex_res || mFullHeight > max_tex_res) - min_discard = 1; //discard_level = llclamp(discard_level, min_discard, (F32)MAX_DISCARD_LEVEL); - discard_level = llclamp(discard_level, min_discard, MAX_DISCARD_LEVEL); // Don't convert to float and back again // [FIRE-35081] // Can't go higher than the max discard level