[gtk/win32.fixes.4-4: 1/9] gdkdisplay-win32.c: Don't retry WGL initialization
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/win32.fixes.4-4: 1/9] gdkdisplay-win32.c: Don't retry WGL initialization
- Date: Fri, 17 Sep 2021 09:58:13 +0000 (UTC)
commit af2c8a3fea88a5048ae2ed8ec7ef2af2a716eeeb
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Fri Sep 17 17:08:23 2021 +0800
gdkdisplay-win32.c: Don't retry WGL initialization
On Windows, GLES is not that widely available unless one installs wrapper
libraries such as libANGLE, so GLES/EGL support on Windows is used more like
a fallback mode if Desktop OpenGL (WGL) support is inadequate on the system.
Hence, unless one forces WGL or EGL, we will first try to initialize WGL, and
then try to initialize GLES if enabled and if WGL initialization failed, and
then just return whatever the last result we can obtain from these
initialization attempts, since unlike X11 EGL contexts, we do not have
separate modes for WGL except for legacy and non-legacy contexts.
gdk/win32/gdkdisplay-win32.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c
index 84d99b78a6..cffd85d432 100644
--- a/gdk/win32/gdkdisplay-win32.c
+++ b/gdk/win32/gdkdisplay-win32.c
@@ -1150,6 +1150,8 @@ static gboolean
gdk_win32_display_init_gl_backend (GdkDisplay *display,
GError **error)
{
+ gboolean result = FALSE;
+
#ifdef GDK_WIN32_ENABLE_EGL
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_EGL))
return gdk_win32_display_init_egl (display, error);
@@ -1161,17 +1163,17 @@ gdk_win32_display_init_gl_backend (GdkDisplay *display,
* as WGL is the more tried-and-tested configuration.
*/
- if (gdk_win32_display_init_wgl (display, error))
- return TRUE;
- g_clear_error (error);
+ result = gdk_win32_display_init_wgl (display, error);
#ifdef GDK_WIN32_ENABLE_EGL
- if (gdk_win32_display_init_egl (display, error))
- return TRUE;
+ if (!result)
+ {
+ g_clear_error (error);
+ result = gdk_win32_display_init_egl (display, error);
+ }
#endif
- g_clear_error (error);
- return gdk_win32_display_init_wgl (display, error);
+ return result;
}
static GdkGLContext *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]