Fix restricting maximum texture resolution and add option for 512 - 1024 pixels, internally ready for even larger texture sizes

master
Zi Ree 2024-06-13 16:30:59 +02:00
parent ed9f48470e
commit edbbd77b2b
4 changed files with 63 additions and 9 deletions

View File

@ -25019,7 +25019,7 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>FSRestrictMaxTextureSize</key>
<map>
<key>Comment</key>
<string>If enabled, the maximum resolution for fetched textures will be restricted and lowered by factor 2 (64bit versions only; requires restart)</string>
<string>If enabled, the maximum resolution for fetched textures will be restricted to FSRestrictMaxTexturePixels pixels (64bit versions only; requires restart)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
@ -25027,6 +25027,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>0</integer>
</map>
<key>FSRestrictMaxTexturePixels</key>
<map>
<key>Comment</key>
<string>Maximum texture resolution when FSRestrictMaxTextureSize is enabled. Must be a power of 2 and at least 512 pixels.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>512</integer>
</map>
<key>FSScriptInfoExtended</key>
<map>
<key>Comment</key>

View File

@ -113,7 +113,7 @@ 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; // <FS:Ansariel> Max texture resolution
/*const*/ U32 DESIRED_NORMAL_TEXTURE_SIZE = 512 // <FS:Ansariel> Max texture resolution // Zi: Pin at 512 since MAX_IMAGE_SIZE_DEFAULT might change again
#else
/*const*/ U32 DESIRED_NORMAL_TEXTURE_SIZE = (U32)LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT; // <FS:Ansariel> Max texture resolution
#endif

View File

@ -2093,11 +2093,30 @@ LLViewerWindow::LLViewerWindow(const Params& p)
gSavedSettings.setU32("RenderQualityPerformance", 0);
}
// <FS:Ansariel> Max texture resolution
// <FS:Ansariel> Max texture resolution / Zi: changed this to accept pixel values so we are independent from maximum texture size
#if ADDRESS_SIZE == 64
if (gSavedSettings.getBOOL("FSRestrictMaxTextureSize"))
{
DESIRED_NORMAL_TEXTURE_SIZE = (U32)LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT / 2;
// fallback value if no matching pixel size is found (i.e. someone fiddled with the debugs)
DESIRED_NORMAL_TEXTURE_SIZE = 512;
// clamp pixels between 512 and half the current maximum texture size
U32 pixels = llclamp(gSavedSettings.getU32("FSRestrictMaxTexturePixels"), 512, (U32)LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT / 2);
// check pixel value against powers of 2 up to (not including) current maximum texture size
U32 pow_of_2 = 512;
while(pow_of_2 < (U32)LLViewerFetchedTexture::MAX_IMAGE_SIZE_DEFAULT)
{
// power of 2 matches, save it
if (pixels == pow_of_2)
{
DESIRED_NORMAL_TEXTURE_SIZE = pixels;
break;
}
// next power of 2
pow_of_2 <<= 1;
}
}
#else
gSavedSettings.setBOOL("FSRestrictMaxTextureSize", TRUE);

View File

@ -1053,7 +1053,7 @@ If you do not understand the distinction then leave this control alone."
label="Freeze updates to World (pause everything)"
tool_tip="Set this to freeze all updates from the server - stops all actions in-world but does not affect chat, IMs or voice"
layout="topleft"
left_delta="5"
left_delta="10"
name="WorldPause"
top_pad="6"
width="256"/>
@ -1074,14 +1074,38 @@ If you do not understand the distinction then leave this control alone."
<check_box
control_name="FSRestrictMaxTextureSize"
height="16"
label="Restrict maximum texture resolution to 512px (64bit only; requires Restart)"
label="(64bit only, requires restart) Restrict maximum texture resolution to:"
tool_tip="Set this restrict the maximum display resolution for inworld textures to 512px. This allows displaying more textures before exceeding the available texture memory and observing blurry textures."
layout="topleft"
left_delta="0"
left_delta="10"
name="FSRestrictMaxTextureSize"
top_pad="2"
top_pad="4"
width="400"/>
<combo_box
control_name="FSRestrictMaxTexturePixels"
enabled_control="FSRestrictMaxTextureSize"
height="23"
layout="topleft"
left_pad="2"
name="FSRestrictMaxTexturePixels"
width="100">
<combo_box.item
label="512 pixels"
name="512"
value="512"/>
<combo_box.item
label="1024 pixels"
name="1024"
value="1024"/>
<!-- 2048 is the current maximum, so this only becomes important if we get 4096 pixel textures
<combo_box.item
label="2048 pixels"
name="2048"
value="2048"/>
-->
</combo_box>
<!-- New Texture detail 5 is lowest, 0 is highest -->
<text
type="string"
@ -1092,7 +1116,7 @@ If you do not understand the distinction then leave this control alone."
width="150"
word_wrap="true"
layout="topleft"
left_delta="0"
left="10"
name="TextureDetailLabel">
Max Texture Quality Level:
</text>