Added EXT_timer_query support
This commit is contained in:
@@ -43,6 +43,21 @@
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef GL_TIME_ELAPSED
|
||||
#define GL_TIME_ELAPSED 0x88BF
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_timer_query
|
||||
#ifdef _WIN32
|
||||
typedef __int64 GLint64EXT;
|
||||
typedef unsigned __int64 GLuint64EXT;
|
||||
#else
|
||||
typedef long long int GLint64EXT;
|
||||
typedef unsigned long long int GLuint64EXT;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
namespace osg {
|
||||
|
||||
|
||||
@@ -576,6 +591,9 @@ class OSG_EXPORT Drawable : public Object
|
||||
void setARBOcclusionQuerySupported(bool flag) { _isARBOcclusionQuerySupported=flag; }
|
||||
bool isARBOcclusionQuerySupported() const { return _isARBOcclusionQuerySupported; }
|
||||
|
||||
void setTimerQuerySupported(bool flag) { _isTimerQuerySupported = flag; }
|
||||
bool isTimerQuerySupported() const { return _isTimerQuerySupported; }
|
||||
|
||||
void glSecondaryColor3ubv(const GLubyte* coord) const;
|
||||
void glSecondaryColor3fv(const GLfloat* coord) const;
|
||||
|
||||
@@ -624,6 +642,7 @@ class OSG_EXPORT Drawable : public Object
|
||||
void glDeleteQueries(GLsizei n, const GLuint *ids) const;
|
||||
void glGetQueryObjectiv(GLuint id, GLenum pname, GLint *params) const;
|
||||
void glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params) const;
|
||||
void glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64EXT *params) const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -660,6 +679,7 @@ class OSG_EXPORT Drawable : public Object
|
||||
typedef void (APIENTRY * EndOcclusionQueryProc) ();
|
||||
typedef void (APIENTRY * GetOcclusionQueryivProc) ( GLuint id, GLenum pname, GLint *params );
|
||||
typedef void (APIENTRY * GetOcclusionQueryuivProc) ( GLuint id, GLenum pname, GLuint *params );
|
||||
typedef void (APIENTRY * GetOcclusionQueryui64vProc) ( GLuint id, GLenum pname, GLuint64EXT *params );
|
||||
|
||||
typedef void (APIENTRY *GenQueriesProc) (GLsizei n, GLuint *ids);
|
||||
typedef void (APIENTRY *DeleteQueriesProc) (GLsizei n, const GLuint *ids);
|
||||
@@ -669,6 +689,7 @@ class OSG_EXPORT Drawable : public Object
|
||||
typedef void (APIENTRY *GetQueryivProc) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRY *GetQueryObjectivProc) (GLuint id, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRY *GetQueryObjectuivProc) (GLuint id, GLenum pname, GLuint *params);
|
||||
typedef void (APIENTRY *GetQueryObjectui64vProc) (GLuint id, GLenum pname, GLuint64EXT *params);
|
||||
|
||||
~Extensions() {}
|
||||
|
||||
@@ -678,6 +699,7 @@ class OSG_EXPORT Drawable : public Object
|
||||
bool _isMultiTexSupported;
|
||||
bool _isOcclusionQuerySupported;
|
||||
bool _isARBOcclusionQuerySupported;
|
||||
bool _isTimerQuerySupported;
|
||||
|
||||
FogCoordProc _glFogCoordfv;
|
||||
|
||||
@@ -725,6 +747,7 @@ class OSG_EXPORT Drawable : public Object
|
||||
GetQueryivProc _gl_get_queryiv_arb;
|
||||
GetQueryObjectivProc _gl_get_query_objectiv_arb;
|
||||
GetQueryObjectuivProc _gl_get_query_objectuiv_arb;
|
||||
GetQueryObjectui64vProc _gl_get_query_objectui64v;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -818,6 +818,8 @@ Drawable::Extensions::Extensions(const Extensions& rhs):
|
||||
_isFogCoordSupported = rhs._isFogCoordSupported;
|
||||
_isMultiTexSupported = rhs._isMultiTexSupported;
|
||||
_isOcclusionQuerySupported = rhs._isOcclusionQuerySupported;
|
||||
_isTimerQuerySupported = rhs._isTimerQuerySupported;
|
||||
|
||||
_glFogCoordfv = rhs._glFogCoordfv;
|
||||
_glSecondaryColor3ubv = rhs._glSecondaryColor3ubv;
|
||||
_glSecondaryColor3fv = rhs._glSecondaryColor3fv;
|
||||
@@ -852,6 +854,7 @@ Drawable::Extensions::Extensions(const Extensions& rhs):
|
||||
_gl_get_queryiv_arb = rhs._gl_get_queryiv_arb;
|
||||
_gl_get_query_objectiv_arb = rhs._gl_get_query_objectiv_arb;
|
||||
_gl_get_query_objectuiv_arb = rhs._gl_get_query_objectuiv_arb;
|
||||
_gl_get_query_objectui64v = rhs._gl_get_query_objectui64v;
|
||||
}
|
||||
|
||||
|
||||
@@ -864,6 +867,8 @@ void Drawable::Extensions::lowestCommonDenominator(const Extensions& rhs)
|
||||
if (!rhs._isOcclusionQuerySupported) _isOcclusionQuerySupported = false;
|
||||
if (!rhs._isARBOcclusionQuerySupported) _isARBOcclusionQuerySupported = false;
|
||||
|
||||
if (!rhs._isTimerQuerySupported) _isTimerQuerySupported = false;
|
||||
|
||||
if (!rhs._glFogCoordfv) _glFogCoordfv = 0;
|
||||
if (!rhs._glSecondaryColor3ubv) _glSecondaryColor3ubv = 0;
|
||||
if (!rhs._glSecondaryColor3fv) _glSecondaryColor3fv = 0;
|
||||
@@ -908,6 +913,7 @@ void Drawable::Extensions::lowestCommonDenominator(const Extensions& rhs)
|
||||
if (!rhs._gl_get_queryiv_arb) _gl_get_queryiv_arb = 0;
|
||||
if (!rhs._gl_get_query_objectiv_arb) _gl_get_query_objectiv_arb = 0;
|
||||
if (!rhs._gl_get_query_objectuiv_arb) _gl_get_query_objectuiv_arb = 0;
|
||||
if (!rhs._gl_get_query_objectui64v) _gl_get_query_objectui64v = 0;
|
||||
}
|
||||
|
||||
void Drawable::Extensions::setupGLExtenions(unsigned int contextID)
|
||||
@@ -919,6 +925,9 @@ void Drawable::Extensions::setupGLExtenions(unsigned int contextID)
|
||||
_isOcclusionQuerySupported = osg::isGLExtensionSupported(contextID, "GL_NV_occlusion_query" );
|
||||
_isARBOcclusionQuerySupported = osg::isGLExtensionSupported(contextID, "GL_ARB_occlusion_query" );
|
||||
|
||||
_isTimerQuerySupported = osg::isGLExtensionSupported(contextID, "GL_EXT_timer_query" );;
|
||||
|
||||
|
||||
_glFogCoordfv = ((FogCoordProc)osg::getGLExtensionFuncPtr("glFogCoordfv","glFogCoordfvEXT"));
|
||||
_glSecondaryColor3ubv = ((SecondaryColor3ubvProc)osg::getGLExtensionFuncPtr("glSecondaryColor3ubv","glSecondaryColor3ubvEXT"));
|
||||
_glSecondaryColor3fv = ((SecondaryColor3fvProc)osg::getGLExtensionFuncPtr("glSecondaryColor3fv","glSecondaryColor3fvEXT"));
|
||||
@@ -963,6 +972,7 @@ void Drawable::Extensions::setupGLExtenions(unsigned int contextID)
|
||||
_gl_get_queryiv_arb = (GetQueryivProc)osg::getGLExtensionFuncPtr("glGetQueryiv", "glGetQueryivARB");
|
||||
_gl_get_query_objectiv_arb = (GetQueryObjectivProc)osg::getGLExtensionFuncPtr("glGetQueryObjectiv","glGetQueryObjectivARB");
|
||||
_gl_get_query_objectuiv_arb = (GetQueryObjectuivProc)osg::getGLExtensionFuncPtr("glGetQueryObjectuiv","glGetQueryObjectuivARB");
|
||||
_gl_get_query_objectui64v = (GetQueryObjectui64vProc)osg::getGLExtensionFuncPtr("glGetQueryObjectui64v","glGetQueryObjectui64vEXT");
|
||||
}
|
||||
|
||||
void Drawable::Extensions::glFogCoordfv(const GLfloat* coord) const
|
||||
@@ -1361,3 +1371,11 @@ void Drawable::Extensions::glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *
|
||||
else
|
||||
osg::notify(osg::WARN) << "Error: glGetQueryObjectuiv not supported by OpenGL driver" << std::endl;
|
||||
}
|
||||
|
||||
void Drawable::Extensions::glGetQueryObjectui64v(GLuint id, GLenum pname, GLuint64EXT *params) const
|
||||
{
|
||||
if (_gl_get_query_objectuiv_arb)
|
||||
_gl_get_query_objectui64v(id, pname, params);
|
||||
else
|
||||
osg::notify(osg::WARN) << "Error: glGetQueryObjectui64v not supported by OpenGL driver" << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user