From 1791ac08a86e69ea004d7e5eb0e1538e7ba7a5b2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 4 Dec 2014 17:12:55 +0000 Subject: [PATCH] Added glMemoryBarrier, glMapBufferRange and glBindBufferBase to GL2Extensions git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14568 16af8721-9629-0410-8352-f15c8da7e697 --- include/osg/GL2Extensions | 44 +++++++++++++++++++++++++++++++++++++++ src/osg/GL2Extensions.cpp | 3 +++ 2 files changed, 47 insertions(+) diff --git a/include/osg/GL2Extensions b/include/osg/GL2Extensions index 38793aa1a..b4223a326 100644 --- a/include/osg/GL2Extensions +++ b/include/osg/GL2Extensions @@ -485,6 +485,46 @@ typedef char GLchar; #define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F #endif +#ifndef GL_VERSION_4_3 +#define GL_SHADER_STORAGE_BARRIER_BIT 0x2000 +#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39 +#define GL_SHADER_STORAGE_BUFFER 0x90D2 +#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 +#define GL_SHADER_STORAGE_BUFFER_START 0x90D4 +#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5 +#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6 +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7 +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9 +#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA +#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB +#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC +#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD +#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE +#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF + + +#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_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 +#endif + namespace osg { class OSG_EXPORT GL2Extensions : public osg::Referenced @@ -679,6 +719,10 @@ class OSG_EXPORT GL2Extensions : public osg::Referenced void (GL_APIENTRY * glGetActiveAtomicCounterBufferiv)( GLuint program, GLuint bufferIndex, GLenum pname, GLint* params ); void (GL_APIENTRY * glDispatchCompute)( GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ ); + void (GL_APIENTRY * glMemoryBarrier)( GLbitfield barriers ); + + GLvoid* (GL_APIENTRY * glMapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); + void (GL_APIENTRY * glBindBufferBase)(GLenum target, GLuint index, GLuint buffer); }; } diff --git a/src/osg/GL2Extensions.cpp b/src/osg/GL2Extensions.cpp index abbe9b5b2..8259ce760 100644 --- a/src/osg/GL2Extensions.cpp +++ b/src/osg/GL2Extensions.cpp @@ -272,6 +272,9 @@ GL2Extensions::GL2Extensions(unsigned int contextID) // ARB_compute_shader setGLExtensionFuncPtr(glDispatchCompute, "glDispatchCompute" ); + setGLExtensionFuncPtr(glMemoryBarrier, "glMemoryBarrier", "glMemoryBarrierEXT" ); + setGLExtensionFuncPtr(glMapBufferRange, "glMapBufferRange" ); + setGLExtensionFuncPtr(glBindBufferBase, "glBindBufferBase", "glBindBufferBaseEXT", "glBindBufferBaseNV" ); }