From d7a57cadd13fa9c1b6d2eb4b9778e3180542f9c6 Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@bred.dog> Date: Mon, 17 Aug 2020 02:31:12 -0400 Subject: [PATCH] Fix shutdown crash from failing to release shadow fbo --- indra/newview/pipeline.cpp | 35 ++++++++++++++++++++--------------- indra/newview/pipeline.h | 1 - 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 3cd33c55edc..f3b4b522d0a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -860,6 +860,7 @@ LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY) ret = FBO_FAILURE; releaseScreenBuffers(); + releaseShadowTargets(); //reduce number of samples while (samples > 0) { @@ -869,6 +870,7 @@ LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY) return FBO_SUCCESS_LOWRES; } releaseScreenBuffers(); + releaseShadowTargets(); } samples = 0; @@ -882,6 +884,7 @@ LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY) return FBO_SUCCESS_LOWRES; } releaseScreenBuffers(); + releaseShadowTargets(); resX /= 2; if (allocateScreenBuffer(resX, resY, samples)) @@ -889,6 +892,7 @@ LLPipeline::eFBOStatus LLPipeline::doAllocateScreenBuffer(U32 resX, U32 resY) return FBO_SUCCESS_LOWRES; } releaseScreenBuffers(); + releaseShadowTargets(); } LL_WARNS() << "Unable to allocate screen buffer at any resolution!" << LL_ENDL; @@ -1046,33 +1050,33 @@ bool LLPipeline::allocateShadowBuffer(U32 resX, U32 resY) } } - U32 width = (U32) (resX*scale); + U32 width = (U32)(resX * scale); U32 height = width; if (shadow_detail > 1) { //allocate two spot shadow maps U32 spot_shadow_map_width = width; - U32 spot_shadow_map_height = height; + U32 spot_shadow_map_height = height; for (U32 i = 4; i < 6; i++) { - if (!mShadow[i].allocate(spot_shadow_map_width, spot_shadow_map_height, 0, TRUE, FALSE)) - { - return false; + if (!mShadow[i].allocate(spot_shadow_map_width, spot_shadow_map_height, 0, TRUE, FALSE)) + { + return false; + } + if (!mShadowOcclusion[i].allocate(spot_shadow_map_width / occlusion_divisor, height / occlusion_divisor, 0, TRUE, FALSE)) + { + return false; + } } - if (!mShadowOcclusion[i].allocate(spot_shadow_map_width/occlusion_divisor, height/occlusion_divisor, 0, TRUE, FALSE)) - { - return false; } - } - } - else - { - for (U32 i = 4; i < 6; i++) + else { - releaseShadowTarget(i); + for (U32 i = 4; i < 6; i++) + { + releaseShadowTarget(i); + } } } - } return true; } @@ -1229,6 +1233,7 @@ void LLPipeline::releaseGLBuffers() } releaseScreenBuffers(); + releaseShadowTargets(); gBumpImageList.destroyGL(); LLVOAvatar::resetImpostors(); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index a6570b1437a..2bcb3691017 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -616,7 +616,6 @@ class LLPipeline LLRenderTarget mUIScreen; LLRenderTarget mDeferredScreen; LLRenderTarget mFXAABuffer; - LLRenderTarget mEdgeMap; LLRenderTarget mDeferredDepth; LLRenderTarget mOcclusionDepth; LLRenderTarget mDeferredLight; -- GitLab