From 0a6a8e763a38c6fa434569261ba992aaf2f2c75f Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 16 Sep 2025 11:19:14 +0100 Subject: [PATCH] Fix overly aggressive check for UAV clears not accounting for depth --- renderdoc/driver/d3d12/d3d12_pixelhistory.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_pixelhistory.cpp b/renderdoc/driver/d3d12/d3d12_pixelhistory.cpp index 3062cdbd9..3461451d4 100644 --- a/renderdoc/driver/d3d12/d3d12_pixelhistory.cpp +++ b/renderdoc/driver/d3d12/d3d12_pixelhistory.cpp @@ -2917,14 +2917,22 @@ rdcarray D3D12Replay::PixelHistory(rdcarray event else if(IsCopyWrite(usage)) resourceState = D3D12_RESOURCE_STATE_COPY_DEST; - // if we are assuming render target state but that's not allowed, this is a UAV clear + // if we are assuming render target state but that's not allowed, check for other states if(resourceState == D3D12_RESOURCE_STATE_RENDER_TARGET && (resDesc.Flags & D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET) == 0) { - RDCASSERT(usage == ResourceUsage::Clear && - (resDesc.Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS), - usage, resDesc.Flags); - resourceState = D3D12_RESOURCE_STATE_UNORDERED_ACCESS; + // if D/S is allowed, assume the state is depth write + if(resDesc.Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL) + { + resourceState = D3D12_RESOURCE_STATE_DEPTH_WRITE; + } + // if it's not D/S either this must be a UAV clear + else + { + RDCASSERT(usage == ResourceUsage::Clear && + (resDesc.Flags & D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS), + usage, resDesc.Flags); + } } eventInfo.resourceState = resourceState;