summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-04-07 12:01:47 +0300
committerAndrei Karas <akaras@inbox.ru>2014-04-07 12:15:23 +0300
commite786bcdc61657e4b2e2cae4bf6f44bb70a14587a (patch)
tree34d0e4e72d185e44ed56ab1ae81cbee29ca5e83b
parentf73819c8e075b0925381052590a5ac9ec6ac1b68 (diff)
downloadmanaverse-e786bcdc61657e4b2e2cae4bf6f44bb70a14587a.tar.gz
manaverse-e786bcdc61657e4b2e2cae4bf6f44bb70a14587a.tar.bz2
manaverse-e786bcdc61657e4b2e2cae4bf6f44bb70a14587a.tar.xz
manaverse-e786bcdc61657e4b2e2cae4bf6f44bb70a14587a.zip
Add support for OpenGL extension GL_GREMEDY_frame_terminator.
It allow show to debugger where is frame termination.
-rw-r--r--src/graphicsmanager.cpp6
-rw-r--r--src/localconsts.h3
-rw-r--r--src/render/mgl.cpp1
-rw-r--r--src/render/mgl.h2
-rw-r--r--src/render/mobileopenglgraphics.cpp6
-rw-r--r--src/render/normalopenglgraphics.cpp6
-rw-r--r--src/render/safeopenglgraphics.cpp6
7 files changed, 30 insertions, 0 deletions
diff --git a/src/graphicsmanager.cpp b/src/graphicsmanager.cpp
index b40f8df57..d158527e1 100644
--- a/src/graphicsmanager.cpp
+++ b/src/graphicsmanager.cpp
@@ -816,6 +816,12 @@ void GraphicsManager::initOpenGLFunctions()
mSupportDebug = 0;
}
+ if (supportExtension("GL_GREMEDY_frame_terminator"))
+ {
+ logger->log1("found GL_GREMEDY_frame_terminator");
+ assignFunction(glFrameTerminator, "glFrameTerminatorGREMEDY");
+ }
+
#ifdef WIN32
assignFunction(wglGetExtensionsString, "wglGetExtensionsStringARB");
#endif
diff --git a/src/localconsts.h b/src/localconsts.h
index d71126c11..05d3909e4 100644
--- a/src/localconsts.h
+++ b/src/localconsts.h
@@ -112,6 +112,9 @@
// use file access fuzzer
// #define USE_FUZZER 1
+// use OpenGL debug features
+#define DEBUG_OPENGL 1
+
#ifdef DYECMD
#undef USE_FUZZER
#endif
diff --git a/src/render/mgl.cpp b/src/render/mgl.cpp
index 54845b944..bd67c2f0e 100644
--- a/src/render/mgl.cpp
+++ b/src/render/mgl.cpp
@@ -42,6 +42,7 @@ defName(glBindSampler);
defName(glSamplerParameteri);
defName(glDebugMessageControl);
defName(glDebugMessageCallback);
+defName(glFrameTerminator);
#ifdef WIN32
defName(wglGetExtensionsString);
diff --git a/src/render/mgl.h b/src/render/mgl.h
index a47a70218..e2e710029 100644
--- a/src/render/mgl.h
+++ b/src/render/mgl.h
@@ -99,6 +99,7 @@ typedef void (APIENTRY *glSamplerParameteri_t)
(GLuint sampler, GLenum pname, GLint param);
typedef void (APIENTRY *glDebugMessageControl_t) (GLenum source, GLenum type,
GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled);
+typedef void (APIENTRY *glFrameTerminator_t) (void);
// callback
typedef void (APIENTRY *GLDEBUGPROC_t) (GLenum source, GLenum type, GLuint id,
@@ -123,6 +124,7 @@ defNameE(glBindSampler);
defNameE(glSamplerParameteri);
defNameE(glDebugMessageControl);
defNameE(glDebugMessageCallback);
+defNameE(glFrameTerminator);
#ifdef WIN32
typedef const char* (APIENTRY * wglGetExtensionsString_t) (HDC hdc);
diff --git a/src/render/mobileopenglgraphics.cpp b/src/render/mobileopenglgraphics.cpp
index 0ad5bfeb7..ede89f115 100644
--- a/src/render/mobileopenglgraphics.cpp
+++ b/src/render/mobileopenglgraphics.cpp
@@ -31,6 +31,8 @@
#include "graphicsvertexes.h"
#include "logger.h"
+#include "render/mgl.h"
+
#include "resources/image.h"
#include "resources/openglimagehelper.h"
@@ -834,6 +836,10 @@ void MobileOpenGLGraphics::updateScreen()
#else
SDL_GL_SwapBuffers();
#endif
+#ifdef DEBUG_OPENGL
+ if (mglFrameTerminator)
+ mglFrameTerminator();
+#endif
// may be need clear?
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
BLOCK_END("Graphics::updateScreen")
diff --git a/src/render/normalopenglgraphics.cpp b/src/render/normalopenglgraphics.cpp
index 72fbd8a99..8f3659936 100644
--- a/src/render/normalopenglgraphics.cpp
+++ b/src/render/normalopenglgraphics.cpp
@@ -30,6 +30,8 @@
#include "graphicsvertexes.h"
#include "logger.h"
+#include "render/mgl.h"
+
#include "resources/image.h"
#include "resources/openglimagehelper.h"
@@ -1095,6 +1097,10 @@ void NormalOpenGLGraphics::updateScreen()
#else
SDL_GL_SwapBuffers();
#endif
+#ifdef DEBUG_OPENGL
+ if (mglFrameTerminator)
+ mglFrameTerminator();
+#endif
// may be need clear?
// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
BLOCK_END("Graphics::updateScreen")
diff --git a/src/render/safeopenglgraphics.cpp b/src/render/safeopenglgraphics.cpp
index a191142b5..177cfecb5 100644
--- a/src/render/safeopenglgraphics.cpp
+++ b/src/render/safeopenglgraphics.cpp
@@ -28,6 +28,8 @@
#include "configuration.h"
#include "graphicsmanager.h"
+#include "render/mgl.h"
+
#include "resources/image.h"
#include "resources/openglimagehelper.h"
@@ -421,6 +423,10 @@ void SafeOpenGLGraphics::updateScreen()
#else
SDL_GL_SwapBuffers();
#endif
+#ifdef DEBUG_OPENGL
+ if (mglFrameTerminator)
+ mglFrameTerminator();
+#endif
BLOCK_END("Graphics::updateScreen")
}