Skip to content

simple-barrier-atomics: properly synchronize access to atomic

barrier() is not enough to ensure that all atomic writes are complete, the recent GLSL 4.60 spec says:

 A barrier() affects control flow but only synchronizes memory
 accesses to shared variables and tessellation control output
 variables. For other memory accesses, it does not ensure that
 values written by one invocation prior to a given static instance
 of barrier() can be safely read by other invocations after their
 call to the same static instance of barrier(). To achieve this
 requires the use of both barrier() and a memory barrier.

A memoryBarrier() before barrier() will ensure that in each invocation the memory write is completed.

Was found while investigated piglit failures on Freedreno. (Without memoryBarrier or memoryBarrierAtomicCounter the test fails on Freedreno).

I think this may somewhat defeat the original purpose of the test, but it still would be useful.

Edited by Danylo Piliaiev

Merge request reports

Loading