From a765ef025db482dcbdbf8002242337b7c04c8f0c Mon Sep 17 00:00:00 2001 From: Jovan Ristic Date: Sun, 16 Jun 2024 00:00:35 -0700 Subject: [PATCH] Fix lack of PS UAVs in d3d11 pixel history. * When a non-zero UAVStartSlot is present, the index in the array and the slot in the shader do not line up. * This fixes both the listing for "Usage in Frame" and pixel history results. --- renderdoc/driver/d3d11/d3d11_context.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/renderdoc/driver/d3d11/d3d11_context.cpp b/renderdoc/driver/d3d11/d3d11_context.cpp index 15dced7c6..14aa6cf78 100644 --- a/renderdoc/driver/d3d11/d3d11_context.cpp +++ b/renderdoc/driver/d3d11/d3d11_context.cpp @@ -1113,11 +1113,14 @@ void WrappedID3D11DeviceContext::AddUsage(const ActionDescription &a) ////////////////////////////// // OM - for(int i = 0; i < D3D11_1_UAV_SLOT_COUNT; i++) + // We iterate over shader slots here, but the matching index in the UAV array + // provided by the user has the first UAV mapping to UAVStartSlot at zero. + for(int i = pipe->OM.UAVStartSlot; i < D3D11_1_UAV_SLOT_COUNT; i++) { - if(pipe->PS.Used_UAV(i) && pipe->OM.UAVs[i]) + if(pipe->PS.Used_UAV(i) && pipe->OM.UAVs[i - pipe->OM.UAVStartSlot]) { - WrappedID3D11UnorderedAccessView1 *view = (WrappedID3D11UnorderedAccessView1 *)pipe->OM.UAVs[i]; + WrappedID3D11UnorderedAccessView1 *view = + (WrappedID3D11UnorderedAccessView1 *)pipe->OM.UAVs[i - pipe->OM.UAVStartSlot]; m_ResourceUses[view->GetResourceResID()].push_back( EventUsage(e, ResourceUsage::PS_RWResource, view->GetResourceID())); }