Fix D3D12 pixel history MSAA test issues.

* Add missing resource transitions for the dispatch copy to fix
validation issues encountered while running the test.
* Adjust the MSAA copy path to use the second channel for stencil to
fix copies failing to output anything, which manifested as the fragment
only showing one primitive without correct output data.
This commit is contained in:
Jovan Ristic authored and Jake Turner committed 2024-01-02 12:15:37 +00:00
1 parent 902a095c60
commit 7e8c22ce68
2 files changed
+22 -3

No files matched your search

+2 -2
View File
@@ -40,7 +40,7 @@ Texture2DArray<float> copyin_depth : register(t0);
Texture2DArray<uint> copyin_stencil : register(t1); Texture2DArray<uint> copyin_stencil : register(t1);
Texture2DMSArray<float> copyin_depth_ms : register(t2); Texture2DMSArray<float> copyin_depth_ms : register(t2);
Texture2DMSArray<uint> copyin_stencil_ms : register(t3); Texture2DMSArray<uint2> copyin_stencil_ms : register(t3);
Texture2DArray<float4> copyin_float : register(t4); Texture2DArray<float4> copyin_float : register(t4);
Texture2DMSArray<float4> copyin_float_ms : register(t5); Texture2DMSArray<float4> copyin_float_ms : register(t5);
@@ -70,7 +70,7 @@ RWBuffer<int> copyout_int : register(u4);
} }
else if(copy_stencil) else if(copy_stencil)
{ {
uint val = copyin_stencil_ms.sample[src_coord.z][uint3(src_coord.xy, src_coord.w)]; uint val = copyin_stencil_ms.sample[src_coord.z][uint3(src_coord.xy, src_coord.w)].g;
copyout_stencil[dst_slot] = val; copyout_stencil[dst_slot] = val;
} }
else else
+20 -1
View File
@@ -596,8 +596,27 @@ protected:
// copy using a compute shader into a staging image first // copy using a compute shader into a staging image first
if(p.multisampled) if(p.multisampled)
{ {
// TODO: Is a resource transition needed here? // For pipeline barriers.
D3D12_RESOURCE_BARRIER barriers[2] = {};
barriers[0] = barrier;
barriers[0].Transition.StateAfter = D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE;
// Validation will complain if we don't transition all subresources for an SRV.
barriers[0].Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
barriers[1].Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
barriers[1].Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
barriers[1].Transition.pResource = m_CallbackInfo.dstBuffer;
barriers[1].Transition.StateBefore = D3D12_RESOURCE_STATE_COPY_DEST;
barriers[1].Transition.StateAfter = D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
barriers[1].Transition.Subresource = 0;
cmd->ResourceBarrier(2, barriers);
m_pDevice->GetDebugManager()->PixelHistoryCopyPixel(cmd, m_CallbackInfo.dstBuffer, p, offset); m_pDevice->GetDebugManager()->PixelHistoryCopyPixel(cmd, m_CallbackInfo.dstBuffer, p, offset);
std::swap(barriers[0].Transition.StateBefore, barriers[0].Transition.StateAfter);
std::swap(barriers[1].Transition.StateBefore, barriers[1].Transition.StateAfter);
cmd->ResourceBarrier(2, barriers);
} }
else else
{ {