From 942527ddf39925e3e77d5c4e30a0fdc245156ada Mon Sep 17 00:00:00 2001 From: William Weaver Date: Tue, 11 Mar 2025 21:34:45 +0300 Subject: **fix: Correctly update shadows on RenderShadowResolutionScale change** MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shadows were not updating correctly after a shader change occurred in-session and then the RenderShadowResolutionScale setting was adjusted. This issue is present in Second Life Release 7.1.12.1355088671 (64-bit) and Second Life Test 7.1.12.250701803 (64-bit). **Specifically, after any shader-related setting is changed in-session (such as toggling Advanced Graphics options like SSAO, HDR, Depth of Field, SSR, Antialiasing, or changing the Graphics Quality preset), subsequent adjustments to `RenderShadowResolutionScale` via Debug Settings result in broken shadow rendering.** The shadows become corrupted or disappear entirely and do not reflect the new resolution scale. Correct shadow rendering is only restored by toggling a shader or restarting the viewer. This behavior is inconsistent with other render settings that update immediately after modification and degrades the user experience when dynamically adjusting shadow quality. This commit changes the signal listener for "RenderShadowResolutionScale" in **llviewercontrol.cpp** from `handleShadowsResized` to `handleSetShaderChanged`. `handleSetShaderChanged` ensures a full shader update, which is necessary for this setting to take effect immediately—similar to other render settings like RenderDeferredSSAO. This change ensures that shadows update correctly and immediately when the resolution scale is changed in Debug Settings, even after prior shader changes in the session, without requiring additional shader toggling or viewer restarts. This provides a smoother and more responsive experience for advanced users adjusting shadow quality in various rendering scenarios. --- **Steps to Reproduce (Bug)** _Verified in Second Life Release 7.1.12.1355088671 (64-bit) and Second Life Test 7.1.12.250701803 (64-bit):_ 1. **Fresh Install Preparation:** Ensure a clean Second Life installation state. Ideally, uninstall and reinstall the viewer or clear/rename all folders in `AppData\Local\Second Life` and `AppData\Roaming\Second Life` before launching. 2. Launch the Second Life Viewer and log in. 3. Enable the Debug Menu: Open Preferences (Ctrl+P), go to the "Advanced" tab, and check "Show Advanced Settings". 4. Open Debug Settings: Click the "Advanced" menu in the menu bar and select "Debug Settings." 5. Locate the `RenderShadowResolutionScale` setting (which should be set to 1.0 on a clean install). 6. Initially, changing `RenderShadowResolutionScale` at this point may not exhibit the bug. Proceed to the next steps to reliably trigger it. 7. **Trigger the Bug:** Open Preferences (Ctrl+P) again and go to the "Graphics" tab. 8. Click the "Advanced Settings" button. 9. **Toggle *any* of the following Advanced Graphics options:** - Screen Space Ambient Occlusion - HDR and Emissive Rendering - Depth of Field - Screen Space Reflections - Antialiasing - *Alternatively*, change the "Graphics Quality" preset slider (e.g., Low to Ultra or any other change). 10. Return to the Debug Settings floater. 11. Change the value of `RenderShadowResolutionScale` to a different value (e.g., from 1.0 to 0.5 or 2.0). 12. **Observe the Bug:** Notice that shadow rendering does not update correctly—shadows become corrupted or disappear. 13. **Workaround (in buggy version):** To restore correct shadow rendering without the fix, either: - Toggle a different shader (e.g., change graphics presets in Preferences, or toggle SSAO, SSR, etc.), or - Restart the viewer. **Steps to Verify (Fix):** 1. Build the viewer with this commit applied. 2. Launch the viewer and log in. 3. Repeat steps 1–9 from "Steps to Reproduce (Bug)" to ensure an Advanced Graphics setting is toggled before proceeding. 4. Open Debug Settings and locate `RenderShadowResolutionScale`. 5. Change the value of `RenderShadowResolutionScale` (e.g., from 1.0 to 0.5 or 2.0). 6. **Verify the Fix:** Confirm that shadow rendering updates immediately and correctly—even after toggling Advanced Graphics settings—with the shadows visibly changing resolution in real time. No shader toggling or viewer restart is required. --- - No specific regression testing is required for this targeted fix. However, standard viewer functionality should be verified after building to ensure no unintended side effects have been introduced. Pay particular attention to shadow rendering in various environments and lighting conditions to confirm the fix has not negatively impacted other shadow-related features. --- - No documentation changes are needed as this is a bug fix for an existing debug setting. --- indra/newview/llviewercontrol.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 598ad89907..1f5ac61040 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -809,7 +809,9 @@ void settings_setup_listeners() setting_setup_signal_listener(gSavedSettings, "RenderSpecularResY", handleLUTBufferChanged); setting_setup_signal_listener(gSavedSettings, "RenderSpecularExponent", handleLUTBufferChanged); setting_setup_signal_listener(gSavedSettings, "RenderAnisotropic", handleAnisotropicChanged); - setting_setup_signal_listener(gSavedSettings, "RenderShadowResolutionScale", handleShadowsResized); + // Ensure shader update on shadow resolution scale change for correct shadow rendering. + // setting_setup_signal_listener(gSavedSettings, "RenderShadowResolutionScale", handleShadowsResized); // Original line commented out + setting_setup_signal_listener(gSavedSettings, "RenderShadowResolutionScale", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "RenderGlow", handleReleaseGLBufferChanged); setting_setup_signal_listener(gSavedSettings, "RenderGlow", handleSetShaderChanged); setting_setup_signal_listener(gSavedSettings, "RenderGlowResolutionPow", handleReleaseGLBufferChanged); -- cgit v1.2.3