Add image-load-store OpenGL extension
This commit is contained in:
parent
fc514577a1
commit
366a0653b5
3 changed files with 97 additions and 1 deletions
|
|
@ -5,7 +5,8 @@
|
|||
"profile": "core",
|
||||
"extensions": [
|
||||
"ARB_texture_filter_anisotropic",
|
||||
"ARB_compute_shader"
|
||||
"ARB_compute_shader",
|
||||
"ARB_shader_image_load_store"
|
||||
],
|
||||
"indent": "\t",
|
||||
"namespace": "gl",
|
||||
|
|
|
|||
|
|
@ -538,6 +538,11 @@ namespace gl
|
|||
extern void (*glDispatchCompute)(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
|
||||
extern void (*glDispatchComputeIndirect)(GLintptr indirect);
|
||||
|
||||
// GL_ARB_shader_image_load_store
|
||||
|
||||
extern void (*glBindImageTexture)(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
|
||||
extern void (*glMemoryBarrier)(GLbitfield barriers);
|
||||
|
||||
// GL_ARB_texture_filter_anisotropic
|
||||
|
||||
|
||||
|
|
@ -1777,6 +1782,76 @@ namespace gl
|
|||
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_shader_image_load_store
|
||||
|
||||
constexpr GLenum VERTEX_ATTRIB_ARRAY_BARRIER_BIT = 0x00000001;
|
||||
constexpr GLenum ELEMENT_ARRAY_BARRIER_BIT = 0x00000002;
|
||||
constexpr GLenum UNIFORM_BARRIER_BIT = 0x00000004;
|
||||
constexpr GLenum TEXTURE_FETCH_BARRIER_BIT = 0x00000008;
|
||||
constexpr GLenum SHADER_IMAGE_ACCESS_BARRIER_BIT = 0x00000020;
|
||||
constexpr GLenum COMMAND_BARRIER_BIT = 0x00000040;
|
||||
constexpr GLenum PIXEL_BUFFER_BARRIER_BIT = 0x00000080;
|
||||
constexpr GLenum TEXTURE_UPDATE_BARRIER_BIT = 0x00000100;
|
||||
constexpr GLenum BUFFER_UPDATE_BARRIER_BIT = 0x00000200;
|
||||
constexpr GLenum FRAMEBUFFER_BARRIER_BIT = 0x00000400;
|
||||
constexpr GLenum TRANSFORM_FEEDBACK_BARRIER_BIT = 0x00000800;
|
||||
constexpr GLenum ATOMIC_COUNTER_BARRIER_BIT = 0x00001000;
|
||||
constexpr GLenum ALL_BARRIER_BITS = 0xFFFFFFFF;
|
||||
constexpr GLenum MAX_IMAGE_UNITS = 0x8F38;
|
||||
constexpr GLenum MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS = 0x8F39;
|
||||
constexpr GLenum IMAGE_BINDING_NAME = 0x8F3A;
|
||||
constexpr GLenum IMAGE_BINDING_LEVEL = 0x8F3B;
|
||||
constexpr GLenum IMAGE_BINDING_LAYERED = 0x8F3C;
|
||||
constexpr GLenum IMAGE_BINDING_LAYER = 0x8F3D;
|
||||
constexpr GLenum IMAGE_BINDING_ACCESS = 0x8F3E;
|
||||
constexpr GLenum IMAGE_1D = 0x904C;
|
||||
constexpr GLenum IMAGE_2D = 0x904D;
|
||||
constexpr GLenum IMAGE_3D = 0x904E;
|
||||
constexpr GLenum IMAGE_2D_RECT = 0x904F;
|
||||
constexpr GLenum IMAGE_CUBE = 0x9050;
|
||||
constexpr GLenum IMAGE_BUFFER = 0x9051;
|
||||
constexpr GLenum IMAGE_1D_ARRAY = 0x9052;
|
||||
constexpr GLenum IMAGE_2D_ARRAY = 0x9053;
|
||||
constexpr GLenum IMAGE_CUBE_MAP_ARRAY = 0x9054;
|
||||
constexpr GLenum IMAGE_2D_MULTISAMPLE = 0x9055;
|
||||
constexpr GLenum IMAGE_2D_MULTISAMPLE_ARRAY = 0x9056;
|
||||
constexpr GLenum INT_IMAGE_1D = 0x9057;
|
||||
constexpr GLenum INT_IMAGE_2D = 0x9058;
|
||||
constexpr GLenum INT_IMAGE_3D = 0x9059;
|
||||
constexpr GLenum INT_IMAGE_2D_RECT = 0x905A;
|
||||
constexpr GLenum INT_IMAGE_CUBE = 0x905B;
|
||||
constexpr GLenum INT_IMAGE_BUFFER = 0x905C;
|
||||
constexpr GLenum INT_IMAGE_1D_ARRAY = 0x905D;
|
||||
constexpr GLenum INT_IMAGE_2D_ARRAY = 0x905E;
|
||||
constexpr GLenum INT_IMAGE_CUBE_MAP_ARRAY = 0x905F;
|
||||
constexpr GLenum INT_IMAGE_2D_MULTISAMPLE = 0x9060;
|
||||
constexpr GLenum INT_IMAGE_2D_MULTISAMPLE_ARRAY = 0x9061;
|
||||
constexpr GLenum UNSIGNED_INT_IMAGE_1D = 0x9062;
|
||||
constexpr GLenum UNSIGNED_INT_IMAGE_2D = 0x9063;
|
||||
constexpr GLenum UNSIGNED_INT_IMAGE_3D = 0x9064;
|
||||
constexpr GLenum UNSIGNED_INT_IMAGE_2D_RECT = 0x9065;
|
||||
constexpr GLenum UNSIGNED_INT_IMAGE_CUBE = 0x9066;
|
||||
constexpr GLenum UNSIGNED_INT_IMAGE_BUFFER = 0x9067;
|
||||
constexpr GLenum UNSIGNED_INT_IMAGE_1D_ARRAY = 0x9068;
|
||||
constexpr GLenum UNSIGNED_INT_IMAGE_2D_ARRAY = 0x9069;
|
||||
constexpr GLenum UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY = 0x906A;
|
||||
constexpr GLenum UNSIGNED_INT_IMAGE_2D_MULTISAMPLE = 0x906B;
|
||||
constexpr GLenum UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY = 0x906C;
|
||||
constexpr GLenum MAX_IMAGE_SAMPLES = 0x906D;
|
||||
constexpr GLenum IMAGE_BINDING_FORMAT = 0x906E;
|
||||
constexpr GLenum IMAGE_FORMAT_COMPATIBILITY_TYPE = 0x90C7;
|
||||
constexpr GLenum IMAGE_FORMAT_COMPATIBILITY_BY_SIZE = 0x90C8;
|
||||
constexpr GLenum IMAGE_FORMAT_COMPATIBILITY_BY_CLASS = 0x90C9;
|
||||
constexpr GLenum MAX_VERTEX_IMAGE_UNIFORMS = 0x90CA;
|
||||
constexpr GLenum MAX_TESS_CONTROL_IMAGE_UNIFORMS = 0x90CB;
|
||||
constexpr GLenum MAX_TESS_EVALUATION_IMAGE_UNIFORMS = 0x90CC;
|
||||
constexpr GLenum MAX_GEOMETRY_IMAGE_UNIFORMS = 0x90CD;
|
||||
constexpr GLenum MAX_FRAGMENT_IMAGE_UNIFORMS = 0x90CE;
|
||||
constexpr GLenum MAX_COMBINED_IMAGE_UNIFORMS = 0x90CF;
|
||||
|
||||
inline void BindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format){ return internal::glBindImageTexture(unit, texture, level, layered, layer, access, format); }
|
||||
inline void MemoryBarrier(GLbitfield barriers){ return internal::glMemoryBarrier(barriers); }
|
||||
|
||||
// GL_ARB_texture_filter_anisotropic
|
||||
|
||||
constexpr GLenum TEXTURE_MAX_ANISOTROPY = 0x84FE;
|
||||
|
|
@ -1792,6 +1867,7 @@ namespace gl
|
|||
int minor_version();
|
||||
|
||||
bool ext_ARB_compute_shader();
|
||||
bool ext_ARB_shader_image_load_store();
|
||||
bool ext_ARB_texture_filter_anisotropic();
|
||||
|
||||
} // namespace sys
|
||||
|
|
|
|||
|
|
@ -472,6 +472,11 @@ namespace gl
|
|||
void (*glDispatchCompute)(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) = nullptr;
|
||||
void (*glDispatchComputeIndirect)(GLintptr indirect) = nullptr;
|
||||
|
||||
// GL_ARB_shader_image_load_store
|
||||
|
||||
void (*glBindImageTexture)(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) = nullptr;
|
||||
void (*glMemoryBarrier)(GLbitfield barriers) = nullptr;
|
||||
|
||||
// GL_ARB_texture_filter_anisotropic
|
||||
|
||||
|
||||
|
|
@ -481,6 +486,7 @@ namespace gl
|
|||
{
|
||||
|
||||
static bool ext_GL_ARB_compute_shader_loaded = false;
|
||||
static bool ext_GL_ARB_shader_image_load_store_loaded = false;
|
||||
static bool ext_GL_ARB_texture_filter_anisotropic_loaded = false;
|
||||
|
||||
static bool load_core()
|
||||
|
|
@ -1222,6 +1228,16 @@ namespace gl
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool load_ext_GL_ARB_shader_image_load_store()
|
||||
{
|
||||
internal::glBindImageTexture = reinterpret_cast<void (*)(GLuint , GLuint , GLint , GLboolean , GLint , GLenum , GLenum )>(internal::get_proc_address("glBindImageTexture"));
|
||||
if (!internal::glBindImageTexture) return false;
|
||||
internal::glMemoryBarrier = reinterpret_cast<void (*)(GLbitfield )>(internal::get_proc_address("glMemoryBarrier"));
|
||||
if (!internal::glMemoryBarrier) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool load_ext_GL_ARB_texture_filter_anisotropic()
|
||||
{
|
||||
|
||||
|
|
@ -1240,6 +1256,8 @@ namespace gl
|
|||
|
||||
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_shader_image_load_store") > 0)
|
||||
ext_GL_ARB_shader_image_load_store_loaded = load_ext_GL_ARB_shader_image_load_store();
|
||||
if (extensions.count("GL_ARB_texture_filter_anisotropic") > 0)
|
||||
ext_GL_ARB_texture_filter_anisotropic_loaded = load_ext_GL_ARB_texture_filter_anisotropic();
|
||||
|
||||
|
|
@ -1253,6 +1271,7 @@ namespace gl
|
|||
int minor_version(){ return 3; }
|
||||
|
||||
bool ext_ARB_compute_shader(){ return ext_GL_ARB_compute_shader_loaded; }
|
||||
bool ext_ARB_shader_image_load_store(){ return ext_GL_ARB_shader_image_load_store_loaded; }
|
||||
bool ext_ARB_texture_filter_anisotropic(){ return ext_GL_ARB_texture_filter_anisotropic_loaded; }
|
||||
|
||||
} // namespace sys
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue