diff options
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
| -rw-r--r-- | Graphics/GraphicsEngineD3D12/src/CommandContext.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp b/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp index 57814d5c..e8617466 100644 --- a/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp +++ b/Graphics/GraphicsEngineD3D12/src/CommandContext.cpp @@ -251,7 +251,10 @@ void StateTransitionHelper::AddD3D12ResourceBarriers(TopLevelASD3D12Impl& TLAS, { // Acceleration structure is always in D3D12_RESOURCE_STATE_RAYTRACING_ACCELERATION_STRUCTURE, // and requires UAV barrier instead of state transition. - m_RequireUAVBarrier |= (m_OldState == RESOURCE_STATE_BUILD_AS_WRITE); + // If either old or new state is a write state, we need to issue a UAV barrier to complete + // all previous read/write operations. + if (m_OldState == RESOURCE_STATE_BUILD_AS_WRITE || m_Barrier.NewState == RESOURCE_STATE_BUILD_AS_WRITE) + m_RequireUAVBarrier = true; #ifdef DILIGENT_DEVELOPMENT if (m_Barrier.NewState & RESOURCE_STATE_RAY_TRACING) @@ -265,7 +268,10 @@ void StateTransitionHelper::AddD3D12ResourceBarriers(BottomLevelASD3D12Impl& BLA { // Acceleration structure is always in D3D12_RESOURCE_STATE_RAYTRACING_ACCELERATION_STRUCTURE, // and requires UAV barrier instead of state transition. - m_RequireUAVBarrier |= (m_OldState == RESOURCE_STATE_BUILD_AS_WRITE); + // If either old or new state is a write state, we need to issue a UAV barrier to complete + // all previous read/write operations. + if (m_OldState == RESOURCE_STATE_BUILD_AS_WRITE || m_Barrier.NewState == RESOURCE_STATE_BUILD_AS_WRITE) + m_RequireUAVBarrier = true; } template <typename ResourceType> |
