Why DX12 requires explicit resource barriers (D3D12_RESOURCE_BARRIER):
Unlike DirectX 11 where the GPU driver inserted implicit pipeline synchronization, DX12 puts resource state management entirely in developer hands.
D3D12_RESOURCE_BARRIER barrier = {};
barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
barrier.Transition.pResource = pRenderTarget;
barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_RENDER_TARGET;
barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;
pCommandList->ResourceBarrier(1, &barrier);Failing to transition a texture before reading it in a compute shader causes GPU read-after-write (RAW) race conditions and corrupted visual artifacts!