From f4663b0e32c8d9717da6ca0105a0dacf33b9d950 Mon Sep 17 00:00:00 2001 From: Julien Valentin Date: Thu, 25 Jan 2018 16:22:33 +0100 Subject: [PATCH] add ARB_BufferStorage extensions --- include/osg/GLExtensions | 2 ++ src/osg/GLExtensions.cpp | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/osg/GLExtensions b/include/osg/GLExtensions index 0d788f2f8..ddc6cdb8d 100644 --- a/include/osg/GLExtensions +++ b/include/osg/GLExtensions @@ -386,6 +386,8 @@ class OSG_EXPORT GLExtensions : public osg::Referenced void (GL_APIENTRY * glDeleteBuffers) (GLsizei n, const GLuint *buffers); GLboolean (GL_APIENTRY * glIsBuffer) (GLuint buffer); void (GL_APIENTRY * glGetBufferSubData) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data); + GLvoid* (GL_APIENTRY * glBufferStorage) (GLenum target, GLintptr size, const GLvoid * data, GLbitfield flags); + GLvoid* (GL_APIENTRY * glNamedBufferStorage) (GLuint buffer, GLsizei size, const void * data, GLbitfield flags); GLvoid* (GL_APIENTRY * glMapBuffer) (GLenum target, GLenum access); GLvoid* (GL_APIENTRY * glMapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); GLboolean (GL_APIENTRY * glUnmapBuffer) (GLenum target); diff --git a/src/osg/GLExtensions.cpp b/src/osg/GLExtensions.cpp index e23fb44f6..01ce03e27 100644 --- a/src/osg/GLExtensions.cpp +++ b/src/osg/GLExtensions.cpp @@ -722,6 +722,8 @@ GLExtensions::GLExtensions(unsigned int in_contextID): setGLExtensionFuncPtr(glDeleteBuffers, "glDeleteBuffers","glDeleteBuffersARB", validContext); setGLExtensionFuncPtr(glIsBuffer, "glIsBuffer","glIsBufferARB", validContext); setGLExtensionFuncPtr(glGetBufferSubData, "glGetBufferSubData","glGetBufferSubDataARB", validContext); + setGLExtensionFuncPtr(glBufferStorage, "glBufferStorage","glBufferStorageARB", validContext); + setGLExtensionFuncPtr(glNamedBufferStorage, "glNamedBufferStorage","glNamedBufferStorageARB", validContext); setGLExtensionFuncPtr(glMapBuffer, "glMapBuffer","glMapBufferARB", validContext); setGLExtensionFuncPtr(glMapBufferRange, "glMapBufferRange", "glMapBufferRangeARB" , validContext); setGLExtensionFuncPtr(glUnmapBuffer, "glUnmapBuffer","glUnmapBufferARB", validContext); @@ -869,18 +871,18 @@ GLExtensions::GLExtensions(unsigned int in_contextID): isTextureCompressionRGTCSupported = validContext && isGLExtensionSupported(contextID,"GL_EXT_texture_compression_rgtc"); isTextureCompressionPVRTCSupported = validContext && isGLExtensionSupported(contextID,"GL_IMG_texture_compression_pvrtc"); - isTextureMirroredRepeatSupported = validContext && + isTextureMirroredRepeatSupported = validContext && (builtInSupport || isGLExtensionOrVersionSupported(contextID,"GL_IBM_texture_mirrored_repeat", 1.4f) || isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_mirrored_repeat", 1.4f)); - isTextureEdgeClampSupported = validContext && + isTextureEdgeClampSupported = validContext && (builtInSupport || isGLExtensionOrVersionSupported(contextID,"GL_EXT_texture_edge_clamp", 1.2f) || isGLExtensionOrVersionSupported(contextID,"GL_SGIS_texture_edge_clamp", 1.2f)); - isTextureBorderClampSupported = validContext && + isTextureBorderClampSupported = validContext && (OSG_GL3_FEATURES || ((OSG_GL1_FEATURES || OSG_GL2_FEATURES) && isGLExtensionOrVersionSupported(contextID,"GL_ARB_texture_border_clamp", 1.3f)) || ((OSG_GLES2_FEATURES || OSG_GLES3_FEATURES) && isGLExtensionSupported(contextID,"GL_EXT_texture_border_clamp"))); @@ -975,7 +977,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID): setGLExtensionFuncPtr(glIsTextureHandleResident, "glIsTextureHandleResident","glIsTextureHandleResidentARB", "glIsTextureHandleResidentNV", validContext); // Blending - isBlendColorSupported = validContext && + isBlendColorSupported = validContext && (OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_EXT_blend_color") || (glVersion >= 1.2f)); @@ -983,13 +985,13 @@ GLExtensions::GLExtensions(unsigned int in_contextID): setGLExtensionFuncPtr(glBlendColor, "glBlendColor", "glBlendColorEXT", validContext); bool bultInSupport = OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES; - isBlendEquationSupported = validContext && + isBlendEquationSupported = validContext && (bultInSupport || isGLExtensionSupported(contextID, "GL_EXT_blend_equation") || (glVersion >= 1.2f)); - isBlendEquationSeparateSupported = validContext && + isBlendEquationSeparateSupported = validContext && (bultInSupport || isGLExtensionSupported(contextID, "GL_EXT_blend_equation_separate") || (glVersion >= 2.0f));