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.
This commit is contained in:
Jovan Ristic
2024-06-16 00:00:35 -07:00
committed by Baldur Karlsson
parent 2ee03b3691
commit a765ef025d
+6 -3
View File
@@ -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()));
}