Fix a getProcAddress in QOpenGLDebugLogger under Win32 + Desktop GL + ATI

We can't resolve a "basic entry point" such as glGetPointerv on Windows'
Desktop GL. Apparently NVIDIA drivers let us do that, but ATI ones don't.

Change-Id: I8e8a54b5dcd3fe87f2bd677d1d0cf08b3e8c11c4
Reviewed-by: Thomas Steen
Reviewed-by: James Turner <james.turner@kdab.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
This commit is contained in:
Giuseppe D'Angelo 2014-02-22 14:48:02 +01:00 committed by The Qt Project
parent e1fd82981c
commit 97ed8f3c0f

View File

@ -43,6 +43,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qvarlengtharray.h>
#include <QtGui/qopengl.h>
#include <QtGui/qopenglfunctions.h>
#include "qopengldebug.h"
@ -1364,7 +1365,20 @@ bool QOpenGLDebugLogger::initialize()
GET_DEBUG_PROC_ADDRESS(glGetDebugMessageLog);
GET_DEBUG_PROC_ADDRESS(glPushDebugGroup);
GET_DEBUG_PROC_ADDRESS(glPopDebugGroup);
// Windows' Desktop GL doesn't allow resolution of "basic GL entry points"
// through wglGetProcAddress
#if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2)
{
HMODULE handle = static_cast<HMODULE>(QOpenGLFunctions::platformGLHandle());
if (!handle)
handle = GetModuleHandleA("opengl32.dll");
d->glGetPointerv = reinterpret_cast<qt_glGetPointerv_t>(GetProcAddress(handle, QByteArrayLiteral("glGetPointerv")));
}
#else
GET_DEBUG_PROC_ADDRESS(glGetPointerv)
#endif
#undef GET_DEBUG_PROC_ADDRESS
glGetIntegerv(GL_MAX_DEBUG_MESSAGE_LENGTH, &d->maxMessageLength);