Merge pull request #243 from mp3butcher/moreExtensions

add Extensions
This commit is contained in:
OpenSceneGraph git repository 2017-04-05 17:39:05 +01:00 committed by GitHub
commit 977bd22e36
2 changed files with 51 additions and 6 deletions

View File

@ -182,7 +182,6 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
bool getFragDataLocation( const char* fragDataName, GLuint& slot) const; bool getFragDataLocation( const char* fragDataName, GLuint& slot) const;
unsigned int contextID; unsigned int contextID;
float glVersion; float glVersion;
float glslLanguageVersion; float glslLanguageVersion;
@ -310,6 +309,8 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
void (GL_APIENTRY * glPatchParameterfv)( GLenum pname, const GLfloat* values ); void (GL_APIENTRY * glPatchParameterfv)( GLenum pname, const GLfloat* values );
void (GL_APIENTRY * glGetUniformuiv)( GLuint program, GLint location, GLuint* params ); void (GL_APIENTRY * glGetUniformuiv)( GLuint program, GLint location, GLuint* params );
void (GL_APIENTRY * glBindFragDataLocation)( GLuint program, GLuint color, const GLchar* name ); void (GL_APIENTRY * glBindFragDataLocation)( GLuint program, GLuint color, const GLchar* name );
void (GL_APIENTRY * glBindFragDataLocationIndexed) (GLuint program, GLuint colorNumber, GLuint index, const GLchar * name);
GLint (GL_APIENTRY * glGetFragDataIndex) (GLuint program, const GLchar * name);
GLint (GL_APIENTRY * glGetFragDataLocation)( GLuint program, const GLchar* name); GLint (GL_APIENTRY * glGetFragDataLocation)( GLuint program, const GLchar* name);
void (GL_APIENTRY * glUniform1ui)( GLint location, GLuint v0 ); void (GL_APIENTRY * glUniform1ui)( GLint location, GLuint v0 );
void (GL_APIENTRY * glUniform2ui)( GLint location, GLuint v0, GLuint v1 ); void (GL_APIENTRY * glUniform2ui)( GLint location, GLuint v0, GLuint v1 );
@ -450,6 +451,8 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
void (GL_APIENTRY * glGenQueries) (GLsizei n, GLuint *ids); void (GL_APIENTRY * glGenQueries) (GLsizei n, GLuint *ids);
void (GL_APIENTRY * glBeginQuery) (GLenum target, GLuint id); void (GL_APIENTRY * glBeginQuery) (GLenum target, GLuint id);
void (GL_APIENTRY * glEndQuery) (GLenum target); void (GL_APIENTRY * glEndQuery) (GLenum target);
void (GL_APIENTRY * glBeginQueryIndexed) (GLenum target, GLuint index, GLuint id);
void (GL_APIENTRY * glEndQueryIndexed) (GLenum target, GLuint index);
void (GL_APIENTRY * glQueryCounter) (GLuint id, GLenum target); void (GL_APIENTRY * glQueryCounter) (GLuint id, GLenum target);
GLboolean (GL_APIENTRY * glIsQuery) (GLuint id); GLboolean (GL_APIENTRY * glIsQuery) (GLuint id);
void (GL_APIENTRY * glDeleteQueries) (GLsizei n, const GLuint *ids); void (GL_APIENTRY * glDeleteQueries) (GLsizei n, const GLuint *ids);
@ -525,6 +528,7 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
void (GL_APIENTRY * glTexParameterIuiv) (GLenum target, GLenum pname, const GLuint* data); void (GL_APIENTRY * glTexParameterIuiv) (GLenum target, GLenum pname, const GLuint* data);
void (GL_APIENTRY * glBindImageTexture) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); void (GL_APIENTRY * glBindImageTexture) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
// Texture3D extensions // Texture3D extensions
bool isTexture3DSupported; bool isTexture3DSupported;
bool isTexture3DFast; bool isTexture3DFast;
@ -537,6 +541,8 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
void (GL_APIENTRY * glCopyTexSubImage3D) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ); void (GL_APIENTRY * glCopyTexSubImage3D) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height );
void (GL_APIENTRY * glCompressedTexImage3D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); void (GL_APIENTRY * glCompressedTexImage3D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
void (GL_APIENTRY * glCompressedTexSubImage3D) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data ); void (GL_APIENTRY * glCompressedTexSubImage3D) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data );
void (GL_APIENTRY *glTexImage3DMultisample) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
void (GL_APIENTRY *glGetMultisamplefv) (GLenum pname, GLuint index, GLfloat *val);
// Texture2DArray extensions // Texture2DArray extensions
bool isTexture2DArraySupported; bool isTexture2DArraySupported;
@ -690,6 +696,25 @@ class OSG_EXPORT GLExtensions : public osg::Referenced
// MultiDrawArrays // MultiDrawArrays
void (GL_APIENTRY * glMultiDrawArrays) (GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount); void (GL_APIENTRY * glMultiDrawArrays) (GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount);
void (GL_APIENTRY * glMultiDrawElements) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount);
void (GL_APIENTRY * glMultiDrawElementsBaseVertex) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex);
void (GL_APIENTRY * glDrawRangeElements) ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices );
void (GL_APIENTRY * glDrawElementsBaseVertex) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
void (GL_APIENTRY * glDrawElementsInstancedBaseVertex) (GLenum mode, GLsizei count, GLenum type, const void *indices,GLsizei primcount, GLint basevertex);
void (GL_APIENTRY * glDrawRangeElementsBaseVertex) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
void (GL_APIENTRY * glProvokingVertex) (GLenum mode);
void (GL_APIENTRY * glBeginConditionalRender) (GLuint id, GLenum mode);
void (GL_APIENTRY * glEndConditionalRender) (void);
void (GL_APIENTRY *glDrawArraysInstancedBaseInstance) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
void (GL_APIENTRY * glDrawElementsInstancedBaseInstance) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
void (GL_APIENTRY *glDrawElementsInstancedBaseVertexBaseInstance) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
// ViewportArray // ViewportArray
bool isViewportArraySupported; bool isViewportArraySupported;

View File

@ -22,7 +22,6 @@
#include <float.h> #include <float.h>
#include <string> #include <string>
#include <vector>
#include <set> #include <set>
#include <sstream> #include <sstream>
@ -438,6 +437,7 @@ void GLExtensions::Set(unsigned int in_contextID, GLExtensions* extensions)
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Extension function pointers for OpenGL v2.x // Extension function pointers for OpenGL v2.x
GLExtensions::GLExtensions(unsigned int in_contextID): GLExtensions::GLExtensions(unsigned int in_contextID):
contextID(in_contextID) contextID(in_contextID)
{ {
@ -632,6 +632,8 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
// EXT_gpu_shader4 // EXT_gpu_shader4
setGLExtensionFuncPtr(glGetUniformuiv, "glGetUniformuiv", "glGetUniformuivEXT", validContext); setGLExtensionFuncPtr(glGetUniformuiv, "glGetUniformuiv", "glGetUniformuivEXT", validContext);
setGLExtensionFuncPtr(glBindFragDataLocation, "glBindFragDataLocation", "glBindFragDataLocationEXT", validContext); setGLExtensionFuncPtr(glBindFragDataLocation, "glBindFragDataLocation", "glBindFragDataLocationEXT", validContext);
setGLExtensionFuncPtr(glBindFragDataLocationIndexed, "glBindFragDataLocationIndexed", "glBindFragDataLocationIndexedEXT", validContext);
setGLExtensionFuncPtr(glGetFragDataIndex, "glGetFragDataIndex", "glGetFragDataIndexEXT", validContext);
setGLExtensionFuncPtr(glGetFragDataLocation, "glGetFragDataLocation", "glGetFragDataLocationEXT", validContext); setGLExtensionFuncPtr(glGetFragDataLocation, "glGetFragDataLocation", "glGetFragDataLocationEXT", validContext);
setGLExtensionFuncPtr(glUniform1ui, "glUniform1ui", "glUniform1uiEXT", validContext); setGLExtensionFuncPtr(glUniform1ui, "glUniform1ui", "glUniform1uiEXT", validContext);
setGLExtensionFuncPtr(glUniform2ui, "glUniform2ui", "glUniform2uiEXT", validContext); setGLExtensionFuncPtr(glUniform2ui, "glUniform2ui", "glUniform2uiEXT", validContext);
@ -784,6 +786,8 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
setGLExtensionFuncPtr(glIsQuery, "glIsQuery", "glIsQueryARB", validContext); setGLExtensionFuncPtr(glIsQuery, "glIsQuery", "glIsQueryARB", validContext);
setGLExtensionFuncPtr(glBeginQuery, "glBeginQuery", "glBeginQueryARB", validContext); setGLExtensionFuncPtr(glBeginQuery, "glBeginQuery", "glBeginQueryARB", validContext);
setGLExtensionFuncPtr(glEndQuery, "glEndQuery", "glEndQueryARB", validContext); setGLExtensionFuncPtr(glEndQuery, "glEndQuery", "glEndQueryARB", validContext);
setGLExtensionFuncPtr(glBeginQueryIndexed, "glBeginQueryIndexed", "glBeginQueryIndexedARB", validContext);
setGLExtensionFuncPtr(glEndQueryIndexed, "glEndQueryIndexed", "glEndQueryIndexedARB", validContext);
setGLExtensionFuncPtr(glGetQueryiv, "glGetQueryiv", "glGetQueryivARB", validContext); setGLExtensionFuncPtr(glGetQueryiv, "glGetQueryiv", "glGetQueryivARB", validContext);
setGLExtensionFuncPtr(glGetQueryObjectiv, "glGetQueryObjectiv","glGetQueryObjectivARB", validContext); setGLExtensionFuncPtr(glGetQueryObjectiv, "glGetQueryObjectiv","glGetQueryObjectivARB", validContext);
setGLExtensionFuncPtr(glGetQueryObjectuiv, "glGetQueryObjectuiv","glGetQueryObjectuivARB", validContext); setGLExtensionFuncPtr(glGetQueryObjectuiv, "glGetQueryObjectuiv","glGetQueryObjectuivARB", validContext);
@ -920,7 +924,8 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
setGLExtensionFuncPtr(glCompressedTexImage3D, "glCompressedTexImage3D","glCompressedTexImage3DARB", validContext); setGLExtensionFuncPtr(glCompressedTexImage3D, "glCompressedTexImage3D","glCompressedTexImage3DARB", validContext);
setGLExtensionFuncPtr(glCompressedTexSubImage3D, "glCompressedTexSubImage3D","glCompressedTexSubImage3DARB", validContext); setGLExtensionFuncPtr(glCompressedTexSubImage3D, "glCompressedTexSubImage3D","glCompressedTexSubImage3DARB", validContext);
setGLExtensionFuncPtr(glCopyTexSubImage3D, "glCopyTexSubImage3D","glCopyTexSubImage3DEXT", validContext); setGLExtensionFuncPtr(glCopyTexSubImage3D, "glCopyTexSubImage3D","glCopyTexSubImage3DEXT", validContext);
setGLExtensionFuncPtr(glBeginConditionalRender, "glBeginConditionalRender", "glBeginConditionalRenderARB");
setGLExtensionFuncPtr(glEndConditionalRender, "glEndConditionalRender", "glEndConditionalRenderARB");
// Texture2DArray extensions // Texture2DArray extensions
isTexture2DArraySupported = validContext && (OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_EXT_texture_array")); isTexture2DArraySupported = validContext && (OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_EXT_texture_array"));
@ -1027,7 +1032,7 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
// Multisample // Multisample
isMultisampleSupported = validContext && (OSG_GLES2_FEATURES || OSG_GLES2_FEATURES || OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_ARB_multisample")); isMultisampleSupported = validContext && (OSG_GLES2_FEATURES || OSG_GLES3_FEATURES || OSG_GL3_FEATURES || isGLExtensionSupported(contextID,"GL_ARB_multisample"));
isMultisampleFilterHintSupported = validContext && isGLExtensionSupported(contextID, "GL_NV_multisample_filter_hint"); isMultisampleFilterHintSupported = validContext && isGLExtensionSupported(contextID, "GL_NV_multisample_filter_hint");
setGLExtensionFuncPtr(glSampleCoverage, "glSampleCoverage", "glSampleCoverageARB", validContext); setGLExtensionFuncPtr(glSampleCoverage, "glSampleCoverage", "glSampleCoverageARB", validContext);
@ -1133,6 +1138,20 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
// MultiDrawArrays // MultiDrawArrays
setGLExtensionFuncPtr(glMultiDrawArrays, "glMultiDrawArrays", "glMultiDrawArraysEXT", validContext); setGLExtensionFuncPtr(glMultiDrawArrays, "glMultiDrawArrays", "glMultiDrawArraysEXT", validContext);
setGLExtensionFuncPtr(glMultiDrawElements, "glMultiDrawElements", "glMultiDrawElementsEXT");
setGLExtensionFuncPtr(glDrawArraysInstancedBaseInstance, "glDrawArraysInstancedBaseInstance", "glDrawArraysInstancedBaseInstanceEXT");
setGLExtensionFuncPtr(glDrawElementsInstancedBaseInstance, "glDrawElementsInstancedBaseInstance", "glDrawElementsInstancedBaseInstanceEXT");
setGLExtensionFuncPtr(glDrawElementsInstancedBaseVertexBaseInstance, "glDrawElementsInstancedBaseVertexBaseInstance", "glDrawElementsInstancedBaseVertexBaseInstanceEXT");
setGLExtensionFuncPtr(glDrawRangeElements, "glDrawRangeElements");
setGLExtensionFuncPtr(glDrawElementsBaseVertex, "glDrawElementsBaseVertex", "glDrawElementsBaseVertexEXT");
setGLExtensionFuncPtr(glDrawRangeElementsBaseVertex, "glDrawRangeElementsBaseVertex", "glDrawRangeElementsBaseVertexEXT");
setGLExtensionFuncPtr(glDrawElementsInstancedBaseVertex, "glDrawElementsInstancedBaseVertex", "glDrawElementsInstancedBaseVertexEXT");
setGLExtensionFuncPtr(glMultiDrawElementsBaseVertex, "glMultiDrawElementsBaseVertex", "glMultiDrawElementsBaseVertexEXT");
setGLExtensionFuncPtr(glProvokingVertex, "glProvokingVertex", "glProvokingVertexEXT");
setGLExtensionFuncPtr(glBeginConditionalRender, "glBeginConditionalRender", "glBeginConditionalRenderEXT");
setGLExtensionFuncPtr(glEndConditionalRender, "glEndConditionalRender", "glEndConditionalRenderEXT");
// ViewportArray // ViewportArray
isViewportArraySupported = validContext && (isGLExtensionOrVersionSupported(contextID, "GL_ARB_viewport_array", 4.1f)); isViewportArraySupported = validContext && (isGLExtensionOrVersionSupported(contextID, "GL_ARB_viewport_array", 4.1f));
@ -1193,8 +1212,8 @@ GLExtensions::GLExtensions(unsigned int in_contextID):
} }
osg::setGLExtensionFuncPtr(glObjectLabel, "glObjectLabel", validContext); osg::setGLExtensionFuncPtr(glObjectLabel, "glObjectLabel", validContext);
}
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
@ -1300,3 +1319,4 @@ bool GLExtensions::getFragDataLocation( const char* fragDataName, GLuint& locati
location = loc; location = loc;
return true; return true;
} }