Which memory barrier does glGenerateMipmap require?

I've written to the first mipmap level of a texture 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, in order to flush the caches appropriately.

For instance, before I do a glTexSubImage2D operation, I need to issue GL_TEXTURE_UPDATE_BARRIER_BIT​, and before I issue a draw call using a shader that samples that texture, I need to issue GL_TEXTURE_FETCH_BARRIER_BIT​.

However, which barrier do I need to issue before I am ensured that glGenerateMipmap will use the most recently written data?


There... is no answer.

The OpenGL 4.5 specification simply has no answer for this particular case. There is no memory barrier that explicitly or implicitly allows glGenerateMipmap to work. And the definition of glGenerateMipmap does not specify the particular operations that the implementation may use to generate those mipmaps.

You found a nice hole in the OpenGL Specification. Hopefully, they'll fix it at some point.


Update: According to the bug report, the current behavior on desktop cards is that glGenerateMipmap doesn't require any form of explicit synchronization. That is, the driver will generate whatever barriers are needed to ensure that it works.

This is also the behavior they intend to go with, should they deign to clarify it in the specification.

链接地址: http://www.djcxy.com/p/21454.html

上一篇: 如何在WCF中使用SynchronizationContext

下一篇: glGenerateMipmap需要哪种内存屏障?