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 <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2015-01-26 19:40:35 +01:00 committed by Jani Heikkinen
parent 817800ad39
commit 44ab91aaa1

View File

@ -358,6 +358,8 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester:
} }
EGLDisplay display = EGL_NO_DISPLAY; EGLDisplay display = EGL_NO_DISPLAY;
EGLint major = 0;
EGLint minor = 0;
#ifdef EGL_ANGLE_platform_angle_opengl #ifdef EGL_ANGLE_platform_angle_opengl
if (libEGL.eglGetPlatformDisplayEXT if (libEGL.eglGetPlatformDisplayEXT
&& (preferredType & QWindowsOpenGLTester::AngleBackendMask)) { && (preferredType & QWindowsOpenGLTester::AngleBackendMask)) {
@ -373,8 +375,13 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester:
attributes = anglePlatformAttributes[1]; attributes = anglePlatformAttributes[1];
else if (preferredType & QWindowsOpenGLTester::AngleRendererD3d11Warp) else if (preferredType & QWindowsOpenGLTester::AngleRendererD3d11Warp)
attributes = anglePlatformAttributes[2]; attributes = anglePlatformAttributes[2];
if (attributes) if (attributes) {
display = libEGL.eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, dc, 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 #else // EGL_ANGLE_platform_angle_opengl
Q_UNUSED(preferredType) Q_UNUSED(preferredType)
@ -386,9 +393,7 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester:
return 0; return 0;
} }
EGLint major; if (!major && !libEGL.eglInitialize(display, &major, &minor)) {
EGLint minor;
if (!libEGL.eglInitialize(display, &major, &minor)) {
int err = libEGL.eglGetError(); int err = libEGL.eglGetError();
qWarning("%s: Could not initialize EGL display: error 0x%x\n", Q_FUNC_INFO, err); qWarning("%s: Could not initialize EGL display: error 0x%x\n", Q_FUNC_INFO, err);
if (err == 0x3001) if (err == 0x3001)