[gtk/win32-gl-improvements: 2/2] gdkdisplay-win32.c: Clean up GL initialization further
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/win32-gl-improvements: 2/2] gdkdisplay-win32.c: Clean up GL initialization further
- Date: Tue, 18 Jan 2022 16:44:34 +0000 (UTC)
commit 25ba6244266affe10f7e1f25dd9b589d031cdf24
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Jan 19 00:18:07 2022 +0800
gdkdisplay-win32.c: Clean up GL initialization further
gdk/win32/gdkdisplay-win32.c | 54 ++++++++++++++++----------------------------
1 file changed, 20 insertions(+), 34 deletions(-)
---
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c
index aee962bd80..a544bf3827 100644
--- a/gdk/win32/gdkdisplay-win32.c
+++ b/gdk/win32/gdkdisplay-win32.c
@@ -1181,7 +1181,6 @@ gdk_win32_display_init_gl (GdkDisplay *display,
{
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (display);
HDC init_gl_hdc = NULL;
- gboolean is_egl = FALSE;
if (display_win32->dummy_context_wgl.hdc == NULL)
display_win32->dummy_context_wgl.hdc = GetDC (display_win32->hwnd);
@@ -1205,53 +1204,40 @@ gdk_win32_display_init_gl (GdkDisplay *display,
init_gl_hdc,
FALSE,
error))
- is_egl = TRUE;
- }
-#endif
-
- if (!is_egl)
- {
- g_clear_error (error);
-
- if (gdk_win32_display_init_wgl (display, error))
{
- gdk_gl_backend_use (GDK_GL_WGL);
- return g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_WGL,
+ return g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_EGL,
"display", display,
NULL);
}
+ else
+ g_clear_error (error);
}
+#endif
-#ifdef HAVE_EGL
- if (!is_egl)
+ if (gdk_win32_display_init_wgl (display, error))
{
- g_clear_error (error);
-
- if (gdk_display_init_egl (display,
- EGL_PLATFORM_ANGLE_ANGLE,
- init_gl_hdc,
- TRUE,
- error))
- is_egl = TRUE;
+ return g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_WGL,
+ "display", display,
+ NULL);
}
- if (is_egl)
- {
- GdkGLContext *gl_context = NULL;
+#ifdef HAVE_EGL
+ g_clear_error (error);
- /* We want to use a GLES 3.0+ context for libANGLE GLES */
- gdk_gl_backend_use (GDK_GL_EGL);
- gl_context = g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_EGL,
- "display", display,
- NULL);
- gdk_gl_context_set_allowed_apis (gl_context, GDK_GL_API_GLES);
- gdk_gl_context_set_required_version (gl_context, 3, 0);
+ if (gdk_display_init_egl (display,
+ EGL_PLATFORM_ANGLE_ANGLE,
+ init_gl_hdc,
+ TRUE,
+ error))
+ {
+ return g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_EGL,
+ "display", display,
+ NULL);
- return gl_context;
}
#endif
- g_return_val_if_reached (NULL);
+ return NULL;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]