What memory barrier does glGenerateMipmap require?

I wrote to the first level mipmap textures using GL_ARB_shader_image_load_store. The documentation states that I need to call glMemoryBarrier before I use the contents of this image in other operations to properly hide the caches.

For example, before performing the glTexSubImage2D operation, I need to issue GL_TEXTURE_UPDATE_BARRIER_BIT, and before I output the draw call using the shader that samples this texture, I need to issue GL_TEXTURE_FETCH_BARRIER_BIT.

However, what barrier do I need to fulfill before I get glGenerateMipmap to use the most recent recorded data?

+7
opengl mipmaps memory-barriers glsl
source share
1 answer

There ... no answer.

There is simply no answer to this particular case in the OpenGL 4.5 specification. There is no memory barrier that allows glGenerateMipmap to work explicitly or implicitly. And the definition of glGenerateMipmap does not indicate the specific operations that the implementation can use to generate these mipmaps.

You have found a good hole in the OpenGL specification. Hope they fix it at some point .


Update. According to the bug report , the current behavior on desktop computers is that glGenerateMipmap does not require any form of explicit synchronization, that is, the driver will generate any barriers necessary to ensure that it works.

This is also the behavior with which they intend to go, if they deigned to clarify it in the specification.

+3
source share

All Articles