diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2025-01-17 22:04:39 +0200 |
---|---|---|
committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-01-21 18:52:18 +0200 |
commit | 9159922bdf47093ba2330ce38ea69562fbbaedb1 (patch) | |
tree | da7a3d31928efd0f9a90f5686bf917d525d5be77 /indra | |
parent | c85880aca971493ea5f7c80b8f152e0e8d00813c (diff) |
#3371 Texture resolution cap #2
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llviewertexture.cpp | 28 |
1 files changed, 8 insertions, 20 deletions
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<bool> 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<U32> 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<bool> 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<U32> 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); |