When the GLSL specification declares “other shader calls”, does it refer to shader calls that were launched only during the current pass, or any possible shader calls in past or future passes?
This means that he says, “Other shader challenges.” It may be the same program code. It may be a different code. It doesn't matter: calls to shaders that are not these.
Normally OpenGL handles synchronization for you, since OpenGL makes it easy to track this. If you map a range of buffer objects, modify and delete it, OpenGL knows how many things you (potentially) changed. If you use glTexSubImage2D, it knows how many things you changed. If you convert the feedback, it can know exactly how much data has been written to the buffer.
If you convert the feedback to a buffer, and then bind it as a vertex data source, OpenGL knows that this will stop the pipeline. So that he had to wait for the conversion feedback to complete, and then clear some caches to use the buffer for these vertices.
When you deal with loading / storing images, you lose all that. Since so much can be written completely by accident, unknown and unknowable, OpenGL usually plays really freely with the rules, to provide you the flexibility to get the best possible performance. This causes a lot of undefined actions.
In general, the only rules you can follow are those described in section 2.11.13 of the OpenGL 4.2 specification. The largest (for conversations with a shader-shader) is the rule at the stages. If you are in the fragment shader, you can safely assume that the vertex shader (s) that specifically calculated the point / line / triangle for your triangle is complete. Therefore, you are free to download the values that were saved by them. But only from those who made you.
Your shaders cannot make assumptions that the shaders executed in previous rendering commands are complete (I know this sounds strange given what I just said, but remember: "only from the ones that made you"). Your shaders cannot make assumptions that other calls to the same shader using the same uniforms, images, textures, etc. In the same rendering team, completed, unless applicable.
The only thing you can assume is that the record of the shader instance you made is visible ... to yourself. Therefore, if you execute imageStore and do imageLoad in the same memory location through the same variable, then you are guaranteed to get the same value back.
Well, until someone else wrote to him.
Your shaders cannot assume that a later render command will certainly retrieve the values recorded (via image storage or atomic updates) by the previous one. No matter how much later! It doesn't matter what you associate with the context. It doesn't matter what you downloaded or downloaded (technically). In some cases, you will get the correct behavior, but the undefined behavior is still undefined).
If you need this guarantee, if you need to issue a render command that will retrieve values recorded using the image / atomic update repository, you should explicitly ask for memory synchronization sometime after issuing a write call and before issuing a read call. This is done using glMemoryBarrier .
Therefore, if you render something that stores the image, you cannot display what uses the stored data until the corresponding barrier is sent (explicitly in the shader or explicitly in the OpenGL code). This may be an image upload operation. But it can be a rendering from a buffer object written by shader code. This could be a texture fetch. This can be a mix with the image attached to the FBO. It does not matter; you cannot do this.
Please note that this applies to all operations related to loading / storing images / atoms, not just shader operations. Therefore, if you use the image storage to write to the image, you will not necessarily read the correct data unless you use the GL_TEXTURE_UPDATE_BARRIER_BIT barrier GL_TEXTURE_UPDATE_BARRIER_BIT