summaryrefslogtreecommitdiffstats
path: root/src/gui/opengl/qopengldebug.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@digia.com>2014-06-20 14:50:17 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2014-08-14 10:23:41 +0200
commitd147535322ef79d819602f453eaf784c99f6e978 (patch)
treec86280200f635a63e7cdd526ba63197c3bd80e1c /src/gui/opengl/qopengldebug.cpp
parentd06c060de47de3981578ba3e74782ab1573bec7e (diff)
Update qopenglext.h and qopengles2ext.h
The current one is from 2012 and is based on the obsolete spec files. Replace it with the new one generated from the XML specs. At the same time fix the callback function signature for QOpenGLDebugLogger since it would not build otherwise. The user parameter is const GLvoid * according to the specification. Task-number: QTBUG-39773 Change-Id: If2153198373eeebc587c41b2dbf6bed5bcb26761 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/gui/opengl/qopengldebug.cpp')
-rw-r--r--src/gui/opengl/qopengldebug.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp
index 79b59a8e98..675f00966a 100644
--- a/src/gui/opengl/qopengldebug.cpp
+++ b/src/gui/opengl/qopengldebug.cpp
@@ -460,6 +460,17 @@ QT_BEGIN_NAMESPACE
connecting to the messageLogged() signal.
*/
+// When using OpenGL ES 2.0, all the necessary GL_KHR_debug constants are
+// provided in qopengles2ext.h. Unfortunately, newer versions of that file
+// suffix everything with _KHR which causes extra headache when the goal is
+// to have a single piece of code that builds in all our target
+// environments. Therefore, try to detect this and use our custom defines
+// instead, which we anyway need for OS X.
+
+#if defined(GL_KHR_debug) && defined(GL_DEBUG_SOURCE_API_KHR)
+#define USE_MANUAL_DEFS
+#endif
+
// Under OSX (at least up to 10.8) we cannot include our copy of glext.h,
// but we use the system-wide one, which unfortunately lacks all the needed
// defines/typedefs. In order to make the code compile, we just add here
@@ -467,6 +478,10 @@ QT_BEGIN_NAMESPACE
#ifndef GL_KHR_debug
#define GL_KHR_debug 1
+#define USE_MANUAL_DEFS
+#endif
+
+#ifdef USE_MANUAL_DEFS
#ifndef GL_DEBUG_OUTPUT_SYNCHRONOUS
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
@@ -589,9 +604,9 @@ QT_BEGIN_NAMESPACE
#define GL_STACK_UNDERFLOW 0x0504
#endif
-typedef void (QOPENGLF_APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
+typedef void (QOPENGLF_APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const GLvoid *userParam);
-#endif /* GL_KHR_debug */
+#endif /* USE_MANUAL_DEFS */
/*!
@@ -1276,9 +1291,9 @@ static void QOPENGLF_APIENTRY qt_opengl_debug_callback(GLenum source,
GLenum severity,
GLsizei length,
const GLchar *rawMessage,
- GLvoid *userParam)
+ const GLvoid *userParam)
{
- QOpenGLDebugLoggerPrivate *loggerPrivate = static_cast<QOpenGLDebugLoggerPrivate *>(userParam);
+ QOpenGLDebugLoggerPrivate *loggerPrivate = static_cast<QOpenGLDebugLoggerPrivate *>(const_cast<GLvoid *>(userParam));
loggerPrivate->handleMessage(source, type, id, severity, length, rawMessage);
}
}