From b1f10865a03cfa8f0e9c27b742f8fbd706772dfc Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Sat, 9 Apr 2022 12:23:32 +0100 Subject: [PATCH] Attach depth RT to command executor before draws This enforces that the depth RT outlives the draw, without this the depth RT could be freed while in active use by command executor leading to UAFs and crashes. --- app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h index dd726fdb..c118fb2f 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h @@ -2569,8 +2569,10 @@ namespace skyline::gpu::interconnect { // Depth/Stencil Render Target Setup auto depthRenderTargetView{GetDepthRenderTarget()}; std::optional> depthTargetLock; - if (depthRenderTargetView) + if (depthRenderTargetView) { depthTargetLock.emplace(*depthRenderTargetView); + executor.AttachTexture(depthRenderTargetView); + } // Draw Persistent Storage struct DrawStorage {