[gtk/wip.win32.fixes: 2/3] GDK: Force GLES 3.0+ on libANGLE
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip.win32.fixes: 2/3] GDK: Force GLES 3.0+ on libANGLE
- Date: Tue, 18 Jan 2022 16:18:50 +0000 (UTC)
commit c45feb7c34b4200dae79b57bde8c780754a89975
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Jan 19 00:16:11 2022 +0800
GDK: Force GLES 3.0+ on libANGLE
...when libANGLE is being used on Windows, by checking for a
Windows-specific an ANGLE-specific extension.
gdk/gdkdisplay.c | 2 ++
gdk/gdkdisplayprivate.h | 1 +
gdk/gdkglcontext.c | 10 ++++++++--
3 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index dddc8b2060..0e935d8176 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -1727,6 +1727,8 @@ gdk_display_init_egl (GdkDisplay *self,
epoxy_has_egl_extension (priv->egl_display, "EGL_KHR_no_config_context");
self->have_egl_pixel_format_float =
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_pixel_format_float");
+ self->have_egl_win32_libangle =
+ epoxy_has_egl_extension (priv->egl_display, "EGL_ANGLE_d3d_share_handle_client_buffer");
if (self->have_egl_no_config_context)
priv->egl_config_high_depth = gdk_display_create_egl_config (self,
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index cb80ad3f88..4eb3625d88 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -110,6 +110,7 @@ struct _GdkDisplay
guint have_egl_swap_buffers_with_damage : 1;
guint have_egl_no_config_context : 1;
guint have_egl_pixel_format_float : 1;
+ guint have_egl_win32_libangle : 1;
};
struct _GdkDisplayClass
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 531344b72e..9b5117b4a1 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -1056,6 +1056,7 @@ gdk_gl_context_get_required_version (GdkGLContext *context,
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
gboolean force_gles = FALSE;
+ gboolean is_win32_libangle = FALSE;
#ifdef G_ENABLE_DEBUG
GdkDisplay *display;
#endif
@@ -1064,18 +1065,23 @@ gdk_gl_context_get_required_version (GdkGLContext *context,
g_return_if_fail (GDK_IS_GL_CONTEXT (context));
-#ifdef G_ENABLE_DEBUG
display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
+
+#ifdef G_ENABLE_DEBUG
force_gles = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES);
#endif
+ /* libANGLE on Windows at least requires GLES 3.0+ */
+ if (display->have_egl_win32_libangle)
+ force_gles = TRUE;
+
/* Default fallback values for uninitialised contexts; we
* enforce a context version number of 3.2 for desktop GL,
* and 2.0 for GLES
*/
if (gdk_gl_context_get_use_es (context) || force_gles)
{
- default_major = 2;
+ default_major = display->have_egl_win32_libangle ? 3 : 2;
default_minor = 0;
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]