From: Matthias Clasen Date: Thu, 19 Oct 2023 17:54:14 +0000 (-0400) Subject: glcontext: Check for GL_EXT_texture_format_BGRA8888 X-Git-Tag: archive/raspbian/4.12.4+ds-3+rpi1^2~21^2^2~27^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9c6a4c3d28371e8745254c58821d04105230c6a7;p=gtk4.git glcontext: Check for GL_EXT_texture_format_BGRA8888 Check for this GLES extension and add a private getter. --- diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index 31c39467e5..3368310f9d 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -109,6 +109,7 @@ typedef struct { guint has_sync : 1; guint has_unpack_subimage : 1; guint has_debug_output : 1; + guint has_bgra : 1; guint extensions_checked : 1; guint debug_enabled : 1; guint forward_compatible : 1; @@ -1531,11 +1532,13 @@ gdk_gl_context_check_extensions (GdkGLContext *context) priv->has_unpack_subimage = gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)) || epoxy_has_gl_extension ("GL_EXT_unpack_subimage"); priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug"); + priv->has_bgra = epoxy_has_gl_extension ("GL_EXT_texture_format_BGRA8888"); } else { priv->has_unpack_subimage = TRUE; priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug"); + priv->has_bgra = TRUE; /* We asked for a core profile, but we didn't get one, so we're in legacy mode */ if (!gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 2))) @@ -1567,7 +1570,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context) " - GL_KHR_debug: %s\n" " - GL_EXT_unpack_subimage: %s\n" " - half float: %s\n" - " - sync: %s", + " - sync: %s\n" + " - bgra: %s", gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL", gdk_gl_version_get_major (&priv->gl_version), gdk_gl_version_get_minor (&priv->gl_version), priv->is_legacy ? "legacy" : "core", @@ -1576,7 +1580,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context) priv->has_khr_debug ? "yes" : "no", priv->has_unpack_subimage ? "yes" : "no", priv->has_half_float ? "yes" : "no", - priv->has_sync ? "yes" : "no"); + priv->has_sync ? "yes" : "no", + priv->has_bgra ? "yes" : "no"); } #endif @@ -1812,6 +1817,14 @@ gdk_gl_context_has_sync (GdkGLContext *self) return priv->has_sync; } +gboolean +gdk_gl_context_has_bgra (GdkGLContext *self) +{ + GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self); + + return priv->has_bgra; +} + /* This is currently private! */ /* When using GL/ES, don't flip the 'R' and 'B' bits on Windows/ANGLE for glReadPixels() */ gboolean diff --git a/gdk/gdkglcontextprivate.h b/gdk/gdkglcontextprivate.h index 9ce133c4b7..f026eaf081 100644 --- a/gdk/gdkglcontextprivate.h +++ b/gdk/gdkglcontextprivate.h @@ -155,6 +155,8 @@ gboolean gdk_gl_context_has_vertex_half_float (GdkGLContext gboolean gdk_gl_context_has_sync (GdkGLContext *self) G_GNUC_PURE; +gboolean gdk_gl_context_has_bgra (GdkGLContext *self) G_GNUC_PURE; + double gdk_gl_context_get_scale (GdkGLContext *self); G_END_DECLS