Update generated OpenGL wrapper to support compute shaders extension

This commit is contained in:
Nikita Lisitsa 2022-04-22 10:21:00 +03:00
parent 30b3536d72
commit 49607f5896
3 changed files with 51 additions and 1 deletions

View file

@ -4,7 +4,8 @@
"version": "3.3",
"profile": "core",
"extensions": [
"ARB_texture_filter_anisotropic"
"ARB_texture_filter_anisotropic",
"ARB_compute_shader"
],
"indent": "\t",
"namespace": "gl",

View file

@ -533,6 +533,11 @@ namespace gl
extern void (*glVertexAttribP4ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value);
extern void (*glVertexAttribP4uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
// GL_ARB_compute_shader
extern void (*glDispatchCompute)(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
extern void (*glDispatchComputeIndirect)(GLintptr indirect);
// GL_ARB_texture_filter_anisotropic
@ -1748,6 +1753,30 @@ namespace gl
inline void VertexAttribP4ui(GLuint index, GLenum type, GLboolean normalized, GLuint value){ return internal::glVertexAttribP4ui(index, type, normalized, value); }
inline void VertexAttribP4uiv(GLuint index, GLenum type, GLboolean normalized, const GLuint *value){ return internal::glVertexAttribP4uiv(index, type, normalized, value); }
// GL_ARB_compute_shader
constexpr GLenum COMPUTE_SHADER = 0x91B9;
constexpr GLenum MAX_COMPUTE_UNIFORM_BLOCKS = 0x91BB;
constexpr GLenum MAX_COMPUTE_TEXTURE_IMAGE_UNITS = 0x91BC;
constexpr GLenum MAX_COMPUTE_IMAGE_UNIFORMS = 0x91BD;
constexpr GLenum MAX_COMPUTE_SHARED_MEMORY_SIZE = 0x8262;
constexpr GLenum MAX_COMPUTE_UNIFORM_COMPONENTS = 0x8263;
constexpr GLenum MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS = 0x8264;
constexpr GLenum MAX_COMPUTE_ATOMIC_COUNTERS = 0x8265;
constexpr GLenum MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS = 0x8266;
constexpr GLenum MAX_COMPUTE_WORK_GROUP_INVOCATIONS = 0x90EB;
constexpr GLenum MAX_COMPUTE_WORK_GROUP_COUNT = 0x91BE;
constexpr GLenum MAX_COMPUTE_WORK_GROUP_SIZE = 0x91BF;
constexpr GLenum COMPUTE_WORK_GROUP_SIZE = 0x8267;
constexpr GLenum UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER = 0x90EC;
constexpr GLenum ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER = 0x90ED;
constexpr GLenum DISPATCH_INDIRECT_BUFFER = 0x90EE;
constexpr GLenum DISPATCH_INDIRECT_BUFFER_BINDING = 0x90EF;
constexpr GLenum COMPUTE_SHADER_BIT = 0x00000020;
inline void DispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z){ return internal::glDispatchCompute(num_groups_x, num_groups_y, num_groups_z); }
inline void DispatchComputeIndirect(GLintptr indirect){ return internal::glDispatchComputeIndirect(indirect); }
// GL_ARB_texture_filter_anisotropic
constexpr GLenum TEXTURE_MAX_ANISOTROPY = 0x84FE;
@ -1762,6 +1791,7 @@ namespace gl
int major_version();
int minor_version();
bool ext_ARB_compute_shader();
bool ext_ARB_texture_filter_anisotropic();
} // namespace sys

View file

@ -467,6 +467,11 @@ namespace gl
void (*glVertexAttribP4ui)(GLuint index, GLenum type, GLboolean normalized, GLuint value) = nullptr;
void (*glVertexAttribP4uiv)(GLuint index, GLenum type, GLboolean normalized, const GLuint *value) = nullptr;
// GL_ARB_compute_shader
void (*glDispatchCompute)(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) = nullptr;
void (*glDispatchComputeIndirect)(GLintptr indirect) = nullptr;
// GL_ARB_texture_filter_anisotropic
@ -475,6 +480,7 @@ namespace gl
namespace sys
{
static bool ext_GL_ARB_compute_shader_loaded = false;
static bool ext_GL_ARB_texture_filter_anisotropic_loaded = false;
static bool load_core()
@ -1206,6 +1212,16 @@ namespace gl
return true;
}
static bool load_ext_GL_ARB_compute_shader()
{
internal::glDispatchCompute = reinterpret_cast<void (*)(GLuint , GLuint , GLuint )>(internal::get_proc_address("glDispatchCompute"));
if (!internal::glDispatchCompute) return false;
internal::glDispatchComputeIndirect = reinterpret_cast<void (*)(GLintptr )>(internal::get_proc_address("glDispatchComputeIndirect"));
if (!internal::glDispatchComputeIndirect) return false;
return true;
}
static bool load_ext_GL_ARB_texture_filter_anisotropic()
{
@ -1222,6 +1238,8 @@ namespace gl
for (GLint i = 0; i < num_extensions; ++i)
extensions.insert(reinterpret_cast<const char *>(internal::glGetStringi(0x1F03, i)));
if (extensions.count("GL_ARB_compute_shader") > 0)
ext_GL_ARB_compute_shader_loaded = load_ext_GL_ARB_compute_shader();
if (extensions.count("GL_ARB_texture_filter_anisotropic") > 0)
ext_GL_ARB_texture_filter_anisotropic_loaded = load_ext_GL_ARB_texture_filter_anisotropic();
@ -1234,6 +1252,7 @@ namespace gl
int minor_version(){ return 3; }
bool ext_ARB_compute_shader(){ return ext_GL_ARB_compute_shader_loaded; }
bool ext_ARB_texture_filter_anisotropic(){ return ext_GL_ARB_texture_filter_anisotropic_loaded; }
} // namespace sys