summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-22 01:16:02 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-22 01:16:02 +0300
commit42670ec6e26e0659b885cbdea2af6a9c71049971 (patch)
tree17cee65b1d719c572e1afb2a20f92db043eef712
parenta50b110c1d5a347158cdb8d28a68237b816797ac (diff)
downloadplus-42670ec6e26e0659b885cbdea2af6a9c71049971.tar.gz
plus-42670ec6e26e0659b885cbdea2af6a9c71049971.tar.bz2
plus-42670ec6e26e0659b885cbdea2af6a9c71049971.tar.xz
plus-42670ec6e26e0659b885cbdea2af6a9c71049971.zip
Add OpenGL extension GL_EXT_timer_query.
-rw-r--r--src/graphicsmanager.cpp15
-rw-r--r--src/render/mgl.cpp6
-rw-r--r--src/render/mgl.h6
-rw-r--r--src/render/mgltypes.h14
4 files changed, 41 insertions, 0 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index be16d68e0..8dbbc75fe 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -831,6 +831,7 @@ void GraphicsManager::initOpenGLFunctions()
const bool is10 = checkGLVersion(1, 0);
const bool is11 = checkGLVersion(1, 1);
const bool is12 = checkGLVersion(1, 2);
+ const bool is15 = checkGLVersion(1, 5);
const bool is20 = checkGLVersion(2, 0);
const bool is21 = checkGLVersion(2, 1);
mSupportModernOpengl = true;
@@ -976,6 +977,20 @@ void GraphicsManager::initOpenGLFunctions()
{
logger->log1("GL_EXT_debug_marker not found");
}
+ if (is15 && supportExtension("GL_EXT_timer_query"))
+ {
+ logger->log1("found GL_EXT_timer_query");
+ assignFunction(glGenQueries, "glGenQueries");
+ assignFunction(glBeginQuery, "glBeginQuery");
+ assignFunction(glEndQuery, "glEndQuery");
+ assignFunction(glDeleteQueries, "glDeleteQueries");
+ assignFunction(glGetQueryObjectiv, "glGetQueryObjectiv");
+ assignFunction(glGetQueryObjectui64v, "glGetQueryObjectui64vEXT");
+ }
+ else
+ {
+ logger->log1("GL_EXT_timer_query not supported");
+ }
if (is20 && supportExtension("GL_ARB_invalidate_subdata"))
{
logger->log1("found GL_ARB_invalidate_subdata");
diff --git a/src/render/mgl.cpp b/src/render/mgl.cpp
index 65064ae84..875c291f8 100644
--- a/src/render/mgl.cpp
+++ b/src/render/mgl.cpp
@@ -101,6 +101,12 @@ defName(glPushDebugGroup);
defName(glPopDebugGroup);
defName(glObjectLabel);
defName(glTexStorage2D);
+defName(glGenQueries);
+defName(glBeginQuery);
+defName(glEndQuery);
+defName(glDeleteQueries);
+defName(glGetQueryObjectiv);
+defName(glGetQueryObjectui64v);
#ifdef WIN32
defName(wglGetExtensionsString);
diff --git a/src/render/mgl.h b/src/render/mgl.h
index 32d27515f..f7579ad1f 100644
--- a/src/render/mgl.h
+++ b/src/render/mgl.h
@@ -104,6 +104,12 @@ defNameE(glPushDebugGroup);
defNameE(glPopDebugGroup);
defNameE(glObjectLabel);
defNameE(glTexStorage2D);
+defNameE(glGenQueries);
+defNameE(glBeginQuery);
+defNameE(glEndQuery);
+defNameE(glDeleteQueries);
+defNameE(glGetQueryObjectiv);
+defNameE(glGetQueryObjectui64v);
#ifdef WIN32
defNameE(wglGetExtensionsString);
diff --git a/src/render/mgltypes.h b/src/render/mgltypes.h
index f8f26c978..c95b88dae 100644
--- a/src/render/mgltypes.h
+++ b/src/render/mgltypes.h
@@ -38,6 +38,12 @@
#include <GL/glext.h>
#endif
+#if defined(__GXX_EXPERIMENTAL_CXX0X__)
+#include <cstdint>
+#else
+#include <stdint.h>
+#endif
+
typedef void (APIENTRY *glGenRenderbuffers_t)(GLsizei, GLuint *);
typedef void (APIENTRY *glBindRenderbuffer_t)(GLenum target,
GLuint renderbuffer);
@@ -158,6 +164,14 @@ typedef void (APIENTRY *glObjectLabel_t) (GLenum identifier, GLuint name,
GLsizei length, const GLchar *label);
typedef void (APIENTRY *glTexStorage2D_t) (GLenum target, GLsizei levels,
GLenum internalformat, GLsizei width, GLsizei height);
+typedef void (APIENTRY *glGenQueries_t) (GLsizei n, GLuint *ids);
+typedef void (APIENTRY *glBeginQuery_t) (GLenum target, GLuint id);
+typedef void (APIENTRY *glEndQuery_t) (GLenum target);
+typedef void (APIENTRY *glDeleteQueries_t) (GLsizei n, const GLuint *ids);
+typedef void (APIENTRY *glGetQueryObjectiv_t) (GLuint id,
+ GLenum pname, GLint *params);
+typedef void (APIENTRY *glGetQueryObjectui64v_t) (GLuint id,
+ GLenum pname, uint64_t *params);
// callback
typedef void (APIENTRY *GLDEBUGPROC_t) (GLenum source, GLenum type, GLuint id,