summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowseglcontext.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-05-27 16:12:57 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-05-28 21:09:44 +0000
commita47dbb010f2bf423a6f0a63bae6676a2788cdfdb (patch)
tree68c2c0906699b5d9422036bda07f6e486481d458 /src/plugins/platforms/windows/qwindowseglcontext.cpp
parentbccdb62340659cfdf4e0f8b53180fb73fda6ea39 (diff)
windows: Use EGL extensions as they ought to be used
We take some shortcuts still because we know that with ANGLE the header with the extension constants is always available. A proper implementation would not rely on the constants being available and would dynamically check for the extension and would take care of defining the constants if not available. However, just getting the extension list to check if the functions needed to get the display are available is already a chicken-egg problem so we won't go there. Using eglGetProcAddress properly solves the issues with static builds too since this always works. Task-number: QTBUG-46284 Change-Id: Iff23669ebacaffa0c5f76fd2c928af689307874f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Gunnar Roth Reviewed-by: Andrew Knight <andrew.knight@intopalo.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowseglcontext.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowseglcontext.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp
index 0184877fdd..06c9985cac 100644
--- a/src/plugins/platforms/windows/qwindowseglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp
@@ -39,7 +39,6 @@
#include <QtGui/QOpenGLContext>
#if defined(QT_OPENGL_ES_2_ANGLE) || defined(QT_OPENGL_DYNAMIC)
-# define EGL_EGLEXT_PROTOTYPES
# include <QtANGLE/EGL/eglext.h>
#endif
@@ -137,7 +136,6 @@ bool QWindowsLibEGL::init()
eglGetError = RESOLVE((EGLint (EGLAPIENTRY *)(void)), eglGetError);
eglGetDisplay = RESOLVE((EGLDisplay (EGLAPIENTRY *)(EGLNativeDisplayType)), eglGetDisplay);
- eglGetPlatformDisplayEXT = RESOLVE((EGLDisplay (EGLAPIENTRY *)(EGLenum platform, void *native_display, const EGLint *attrib_list)), eglGetPlatformDisplayEXT);
eglInitialize = RESOLVE((EGLBoolean (EGLAPIENTRY *)(EGLDisplay, EGLint *, EGLint *)), eglInitialize);
eglTerminate = RESOLVE((EGLBoolean (EGLAPIENTRY *)(EGLDisplay)), eglTerminate);
eglChooseConfig = RESOLVE((EGLBoolean (EGLAPIENTRY *)(EGLDisplay, const EGLint *, EGLConfig *, EGLint, EGLint *)), eglChooseConfig);
@@ -156,7 +154,15 @@ bool QWindowsLibEGL::init()
eglSwapBuffers = RESOLVE((EGLBoolean (EGLAPIENTRY *)(EGLDisplay , EGLSurface)), eglSwapBuffers);
eglGetProcAddress = RESOLVE((__eglMustCastToProperFunctionPointerType (EGLAPIENTRY * )(const char *)), eglGetProcAddress);
- return eglGetError && eglGetDisplay && eglInitialize;
+ if (!eglGetError || !eglGetDisplay || !eglInitialize || !eglGetProcAddress)
+ return false;
+
+ eglGetPlatformDisplayEXT = 0;
+#ifdef EGL_ANGLE_platform_angle
+ eglGetPlatformDisplayEXT = reinterpret_cast<EGLDisplay (EGLAPIENTRY *)(EGLenum, void *, const EGLint *)>(eglGetProcAddress("eglGetPlatformDisplayEXT"));
+#endif
+
+ return true;
}
#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC)
@@ -360,7 +366,7 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester:
EGLDisplay display = EGL_NO_DISPLAY;
EGLint major = 0;
EGLint minor = 0;
-#ifdef EGL_ANGLE_platform_angle_opengl
+#ifdef EGL_ANGLE_platform_angle
if (libEGL.eglGetPlatformDisplayEXT
&& (preferredType & QWindowsOpenGLTester::AngleBackendMask)) {
const EGLint anglePlatformAttributes[][5] = {
@@ -384,7 +390,7 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester:
}
}
}
-#else // EGL_ANGLE_platform_angle_opengl
+#else // EGL_ANGLE_platform_angle
Q_UNUSED(preferredType)
#endif
if (display == EGL_NO_DISPLAY)