From 44ab91aaa131c5a2c398cf30a97046578150db38 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 26 Jan 2015 19:40:35 +0100 Subject: Windows/ANGLE: Fix initialization of contexts. Immediately try to initialize a context obtained by eglGetPlatformDisplayEXT() and clear display in case it fails, falling back to eglGetDisplay(). Change-Id: Ia6c1c6da4daff6651153c854eda4fb8749bdc526 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/windows/qwindowseglcontext.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index bde0503ee0..7f0421ad90 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -358,6 +358,8 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester: } EGLDisplay display = EGL_NO_DISPLAY; + EGLint major = 0; + EGLint minor = 0; #ifdef EGL_ANGLE_platform_angle_opengl if (libEGL.eglGetPlatformDisplayEXT && (preferredType & QWindowsOpenGLTester::AngleBackendMask)) { @@ -373,8 +375,13 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester: attributes = anglePlatformAttributes[1]; else if (preferredType & QWindowsOpenGLTester::AngleRendererD3d11Warp) attributes = anglePlatformAttributes[2]; - if (attributes) + if (attributes) { display = libEGL.eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, dc, attributes); + if (!libEGL.eglInitialize(display, &major, &minor)) { + display = EGL_NO_DISPLAY; + major = minor = 0; + } + } } #else // EGL_ANGLE_platform_angle_opengl Q_UNUSED(preferredType) @@ -386,9 +393,7 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester: return 0; } - EGLint major; - EGLint minor; - if (!libEGL.eglInitialize(display, &major, &minor)) { + if (!major && !libEGL.eglInitialize(display, &major, &minor)) { int err = libEGL.eglGetError(); qWarning("%s: Could not initialize EGL display: error 0x%x\n", Q_FUNC_INFO, err); if (err == 0x3001) -- cgit v1.2.3