View Full Version : Ensuring memory synchronization across invocations in the same dispatch

08-17-2016, 05:56 AM
I am trying to implement a persistent thread based approach in OpenGL and I have confused myself over memory synchronization issues between invocations _within_ the same dispatch - not just the same work group in a dispatch.

If for example I mark a SSBO coherent, and within that SSBO I manage a list that I wish the different invocations within the same dispatch to access and modify. I guard the list with an atomic based compare/exchange spin lock.

Then if an invocation locks the list, makes a change to the list, unlocks the list. Then somewhere(?) in that order of events it should call a memoryBarrier() to make sure all the list changes are visible to the other invocations within the same dispatch _during_ that dispatch?

Am I correct in thinking that I only need an atomic for the lock guarding the list, and the items in the list and its length need no further protection then the lock guarding the list - apart from the SSBO being marked coherent?