diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-02-19 06:08:22 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-03-19 00:38:09 +0000 |
| commit | b71e4f535f028b115ec3105c8d28de75e2c13809 (patch) | |
| tree | 7b43b9e1945f613e723f7d64c8a55801b0d577f0 /Graphics/GraphicsEngineD3D12 | |
| parent | D3D12 backend: some code cleanup (diff) | |
| download | DiligentCore-b71e4f535f028b115ec3105c8d28de75e2c13809.tar.gz DiligentCore-b71e4f535f028b115ec3105c8d28de75e2c13809.zip | |
D3D12 comamnd context: updated state transitions for RT acceleration structures
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> |
