From 239e0306a8568fa7abe8ebe17306dcdfb64c29e6 Mon Sep 17 00:00:00 2001 From: moudgils <47460854+moudgils@users.noreply.github.com> Date: Wed, 17 Nov 2021 16:07:22 -0800 Subject: [PATCH] Fix DOF flickering on Vk due to missing LDS sync (#5723) * Fix DOF flickering on Vk due to missing LDS sync Signed-off-by: moudgils * Added another sync Signed-off-by: moudgils --- .../Shaders/PostProcessing/NewDepthOfFieldTileReduce.azsl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/NewDepthOfFieldTileReduce.azsl b/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/NewDepthOfFieldTileReduce.azsl index 6d55648f22..db91c369ef 100644 --- a/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/NewDepthOfFieldTileReduce.azsl +++ b/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/NewDepthOfFieldTileReduce.azsl @@ -48,6 +48,9 @@ void MainCS(uint3 group_thread_id : SV_GroupThreadID, uint3 group_id : SV_GroupI LDS_MAX_COC[group_thread_id.x] = 0; } + // Sync LDS + GroupMemoryBarrierWithGroupSync(); + // We use gather to get 2x2 values at once, so thread samples are spaced 2 pixels apart (+1 so the sample position is in between the four pixels) float2 samplePos = float2(dispatch_id.xy) * 2 + float2(1, 1); float2 sampleUV = samplePos * PassSrg::m_inputDimensions.zw; @@ -74,6 +77,9 @@ void MainCS(uint3 group_thread_id : SV_GroupThreadID, uint3 group_id : SV_GroupI InterlockedMin( LDS_MIN_COC[0], LDS_MIN_COC[group_thread_id.x] ); InterlockedMax( LDS_MAX_COC[0], LDS_MAX_COC[group_thread_id.x] ); + // Sync LDS + GroupMemoryBarrierWithGroupSync(); + // Each group write to just one pixel. If we're the last thread in the group, write out if(group_thread_id.x == 0) {