KhronosGroup / OpenGL-Registry

OpenGL, OpenGL ES, and OpenGL ES-SC API and Extension Registry
679 stars 274 forks source link

Outdated specification regarding MemoryBarrierNV #507

Closed stephen-hqxu closed 2 years ago

stephen-hqxu commented 2 years ago

There are two NV extensions mentioning the use of function MemoryBarrierNV, however this function cannot be found in the API.

In NV_gpu_program5, the issue 19 mentioned something regarding the function MemoryBarrierEXT, but the answer demonstrated the use of MemoryBarrierNV. As a side note, MemoryBarrierEXT and TEXTURE_FETCH_BARRIER_BIT_NV cannot be found in the API either.

https://github.com/KhronosGroup/OpenGL-Registry/blob/b0643365776c260efc6317d2ff67dd8bf5078be9/extensions/NV/NV_gpu_program5.txt#L3057-L3084

In NV_shader_buffer_store, token SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV is added to MemoryBarrierNV.

https://github.com/KhronosGroup/OpenGL-Registry/blob/b0643365776c260efc6317d2ff67dd8bf5078be9/extensions/NV/NV_shader_buffer_store.txt#L84-L86

According to the API, here are all tokens the GL 4.2 core API function MemoryBarrier support:


#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
#define GL_ELEMENT_ARRAY_BARRIER_BIT      0x00000002
#define GL_UNIFORM_BARRIER_BIT            0x00000004
#define GL_TEXTURE_FETCH_BARRIER_BIT      0x00000008
#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
#define GL_COMMAND_BARRIER_BIT            0x00000040
#define GL_PIXEL_BUFFER_BARRIER_BIT       0x00000080
#define GL_TEXTURE_UPDATE_BARRIER_BIT     0x00000100
#define GL_BUFFER_UPDATE_BARRIER_BIT      0x00000200
#define GL_FRAMEBUFFER_BARRIER_BIT        0x00000400
#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800
#define GL_ATOMIC_COUNTER_BARRIER_BIT     0x00001000
#define GL_ALL_BARRIER_BITS               0xFFFFFFFF
#define GL_SHADER_STORAGE_BARRIER_BIT     0x00002000
#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000
#define GL_QUERY_BUFFER_BARRIER_BIT       0x00008000

While GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV is defined as.


#define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010

This token value 0x00000010 is not used by any token accepted by MemoryBarrier, so it that safe to assume MemoryBarrier is now the intended function to be used with GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV? I have tried to use SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV on MemoryBarrier. The call to function MemoryBarrier(GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV) did not return any error.

Perhaps the extension specifications are outdated regarding usage MemoryBarrierNV as it has been removed from the API and merged with the functionality provided by MemoryBarrier?

pdaniell-nv commented 2 years ago

Yes I think those references to MemoryBarrierNV are outdated, and should probably be updated to reference MemoryBarrierEXT, which is defined in GL_EXT_shader_image_load_store or the core MemoryBarrier function where appropriate.

Regarding GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV, yes that can be used with either MemoryBarrier, or MemoryBarrierEXT, which is an alias of MemoryBarrier.

stephen-hqxu commented 2 years ago

I could not find MemoryBarrierEXT in the API either, maybe it was removed too?

pdaniell-nv commented 2 years ago

I could not find MemoryBarrierEXT in the API either, maybe it was removed too?

I see it here: https://github.com/KhronosGroup/OpenGL-Registry/blob/main/api/GL/glext.h#L8209