Memory and texture barriers in OpenGL

Do I need to define memory barriers in OpenGL in between setting buffer data and rendering?

If I set an object’s 4x4 transformation stored in a storage buffer, do I need to define a memory barrier before I start rendering? Or is this just for separating buffer read and write commands?

Do I need to define a texture barrier after rendering to a texture, that will be read from in subsequent draw calls? For example, if I render shadows into a shadow map do I need to define a texture barrier before that shadow map is read from in lighting routines?

Unlike Vulkan, OpenGL is functionally synchronous. While the implementation behind the scenes will attempt to execute the operations you give it asynchronously, the OpenGL abstraction hides all of this behind a memory model that is synchronous.

With a few exceptions.

A glMemoryBarrier is needed when writing data via specific incoherent mechanisms. So whether you need a barrier depends on whether you are using one of those mechanisms to set the buffer’s data.

A texture barrier is a tool for allowing you to use a texture as both a render target and a sample source at the same time. If you changed draw FBOs between the render to texture and the read from a shader, then you’re not doing the above and therefore don’t need one.