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.
This commit is contained in:
Billy Laws 2022-04-09 12:23:32 +01:00 committed by PixelyIon
parent 0182fabc50
commit b1f10865a0

View File

@ -2569,8 +2569,10 @@ namespace skyline::gpu::interconnect {
// Depth/Stencil Render Target Setup // Depth/Stencil Render Target Setup
auto depthRenderTargetView{GetDepthRenderTarget()}; auto depthRenderTargetView{GetDepthRenderTarget()};
std::optional<std::scoped_lock<TextureView>> depthTargetLock; std::optional<std::scoped_lock<TextureView>> depthTargetLock;
if (depthRenderTargetView) if (depthRenderTargetView) {
depthTargetLock.emplace(*depthRenderTargetView); depthTargetLock.emplace(*depthRenderTargetView);
executor.AttachTexture(depthRenderTargetView);
}
// Draw Persistent Storage // Draw Persistent Storage
struct DrawStorage { struct DrawStorage {