From e1ebb33ab2966a20b63741dd84a0826e82b6a807 Mon Sep 17 00:00:00 2001 From: William Weaver Date: Fri, 28 Mar 2025 04:28:36 +0300 Subject: fix(pipeline): Remove incorrect zeroing of mRT dimensions in createGLBuffers Resolves the root cause of shadow rendering failures when changing RenderShadowResolutionScale immediately after modifying other graphics settings (e.g., SSAO, HDR). Investigation revealed that LLPipeline::createGLBuffers, which is called during certain graphics setting changes that require full buffer recreation, contained lines that incorrectly set mRT->width and mRT->height to zero *after* the call to allocateScreenBuffer had already established the correct dimensions. This created a state inconsistency. If RenderShadowResolutionScale was changed immediately following the graphics setting change, the subsequent call to LLPipeline::resizeShadowTexture (triggered via handleShadowsResized) would read these incorrect zero dimensions from mRT. This led to failed shadow buffer allocation (allocateShadowBuffer(0, 0)) and resulted in corrupted or missing shadows. This commit removes the erroneous mRT->width = 0 and mRT->height = 0 lines from the end of createGLBuffers. This ensures that the render target dimensions remain valid after buffer recreation. With this fix, resizeShadowTexture now correctly reads the valid screen dimensions immediately following a graphics setting change and successfully resizes the shadow buffers without delay or error. This eliminates the need for previous workarounds like guard conditions or forced shader recompiles. Ref: #3719 --- indra/newview/pipeline.cpp | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 'indra') diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 691d155a3c..6adf203ea1 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -727,29 +727,6 @@ void LLPipeline::requestResizeShadowTexture() void LLPipeline::resizeShadowTexture() { - // A static counter to keep track of skipped frames - static int sSkippedFrameCount = 0; - - if (!mRT || mRT->width == 0 || mRT->height == 0) - { - sSkippedFrameCount++; - LL_WARNS("Render") << "Shadow texture resizing aborted: render target dimensions invalid. Skipped " - << sSkippedFrameCount << " frame(s) so far." << LL_ENDL; - return; - } - - // If there were skipped frames before mRT became valid, log that information. - if (sSkippedFrameCount > 0) - { - LL_INFOS("Render") << "Render target now valid after " - << sSkippedFrameCount << " skipped frame(s)." << LL_ENDL; - sSkippedFrameCount = 0; - } - - LL_WARNS() << "LLPipeline::resizeShadowTexture() called." << LL_ENDL; - LL_INFOS() << "Resizing shadow texture. mRT->width = " - << mRT->width << " mRT->height = " << mRT->height << LL_ENDL; - releaseSunShadowTargets(); releaseSpotShadowTargets(); allocateShadowBuffer(mRT->width, mRT->height); @@ -1309,8 +1286,11 @@ void LLPipeline::createGLBuffers() } allocateScreenBuffer(resX, resY); - mRT->width = 0; - mRT->height = 0; + // Do not zero out mRT dimensions here. allocateScreenBuffer() above + // already sets the correct dimensions. Zeroing them caused resizeShadowTexture() + // to fail if called immediately after createGLBuffers (e.g., post graphics change). + // mRT->width = 0; + // mRT->height = 0; if (!mNoiseMap) -- cgit v1.2.3