From 2bf74622a512998517cbe92ec80cfd1f8be591a3 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sun, 26 Feb 2023 13:03:01 +1000 Subject: [PATCH] GS/DX12: Fix potential crash in PrimID DATE setup --- pcsx2/GS/Renderers/DX12/GSDevice12.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pcsx2/GS/Renderers/DX12/GSDevice12.cpp b/pcsx2/GS/Renderers/DX12/GSDevice12.cpp index e2857ae970..4bc9049d5f 100644 --- a/pcsx2/GS/Renderers/DX12/GSDevice12.cpp +++ b/pcsx2/GS/Renderers/DX12/GSDevice12.cpp @@ -2350,13 +2350,12 @@ GSTexture12* GSDevice12::SetupPrimitiveTrackingDATE(GSHWDrawConfig& config, Pipe OMSetRenderTargets(image, config.ds, config.drawarea); // if the depth target has been cleared, we need to preserve that clear - BeginRenderPass( - D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_DISCARD, D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE, - GetLoadOpForTexture(static_cast(config.ds)), + BeginRenderPass(D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_DISCARD, D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE, + config.ds ? GetLoadOpForTexture(static_cast(config.ds)) : + D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_NO_ACCESS, config.ds ? D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE : D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_NO_ACCESS, D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE_NO_ACCESS, D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_NO_ACCESS, - GSVector4::zero(), - static_cast(config.ds)->GetClearDepth()); + GSVector4::zero(), config.ds ? static_cast(config.ds)->GetClearDepth() : 0.0f); // draw the quad to prefill the image const GSVector4 src = GSVector4(config.drawarea) / GSVector4(rtsize).xyxy();