From 54ca0665c8a57e85525b569c890cb3dc3ccc679b Mon Sep 17 00:00:00 2001 From: Friedrich Vock Date: Sun, 18 Dec 2022 20:34:09 +0100 Subject: [PATCH] radv/rt: Execute memory barrier before updating the phase end count We want to be sure that the values were updated before letting other invocations continue. Fixes: 271865373 ("radv: Add PLOC shader") Part-of: --- src/amd/vulkan/bvh/build_helpers.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/bvh/build_helpers.h b/src/amd/vulkan/bvh/build_helpers.h index cd9513e4a44..fb5684ba8cd 100644 --- a/src/amd/vulkan/bvh/build_helpers.h +++ b/src/amd/vulkan/bvh/build_helpers.h @@ -460,13 +460,13 @@ fetch_task(REF(radv_ir_header) header, bool did_work) atomicAdd(DEREF(header).sync_data.phase_index, 1); DEREF(header).sync_data.current_phase_start_counter = DEREF(header).sync_data.current_phase_end_counter; - atomicAdd(DEREF(header).sync_data.current_phase_end_counter, - DIV_ROUND_UP(task_count(header), gl_WorkGroupSize.x)); /* Ensure the changes to the phase index and start/end counter are visible for other * workgroup waiting in the loop. */ memoryBarrier( gl_ScopeDevice, gl_StorageSemanticsBuffer, gl_SemanticsAcquireRelease | gl_SemanticsMakeAvailable | gl_SemanticsMakeVisible); + atomicAdd(DEREF(header).sync_data.current_phase_end_counter, + DIV_ROUND_UP(task_count(header), gl_WorkGroupSize.x)); break; }