Looking at it again, I see I misread the diff report. I thought the whole paragraph starting with “However, if memory has been modified in an incoherent fashion…” was added.
In any case, I re-re-re-reread that Wiki page and I don’t get to the conclusion that
I’m hoping I’m just dense
Here’s how I read it:
There are a number of advanced operations that perform what we call “incoherent memory accesses”:
That’s me
However, if memory has been modified in an incoherent fashion, any subsequent reads from that memory are not automatically guaranteed to see these changes. These reads could be from any OpenGL operation that reads from the memory. This includes, but is not limited to:
I expect atomics are included in this
Furthermore, any subsequent writes to those memory locations are not guaranteed to overwrite the value written incoherently.
That’s my scenario.
First, within a single shader invocation, if you perform an incoherent memory write, the value written will always be visible for reading. But only through that particular variable and only within the shader invocation that issued the write. You need not do anything special to make this happen. However, it is possible that, between writing and reading, another invocation may have stomped on that value. So long as that is not the case, reading it will produce the value you have written.
With work group size > 1
, there are multiple compute shader invocations in parallel. If these invocations all do atomicAdd
s, they can stomp each other right?
Internal visibility
After ensuring ordering, the other element that is needed for visibility is special GLSL syntax. The image or buffer variable being written to and read from must be qualified by the coherent qualifier. Note that both the writer and reader shaders must qualify their variables properly; otherwise, nothing is guaranteed.
My scenario is within a single rendering command so this part seems to apply as well.
Like I said, I don’t think atomics make much sense if they’re not implicitly coherent inside a single rendering command so I definitely want to agree with what you said! I’m just looking for confirmation.