OpenGL/ES: Fix 'R' and 'B' bits inverted on all platforms

The color channels are swapped on Linux too, not only on Windows. It can be
reproduced by running the "OpenGL Area" example from gtk3-demo with
GDK_GL=gles, or play a video in totem with GDK_GL=gles.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3032
This commit is contained in:
Balló György
2023-09-27 14:08:07 +02:00
parent 9e45d0cef6
commit 261780ac51
3 changed files with 15 additions and 12 deletions

View File

@ -102,6 +102,7 @@ typedef struct {
guint has_frame_terminator : 1;
guint has_unpack_subimage : 1;
guint has_sync : 1;
guint has_texture_format_bgra : 1;
guint extensions_checked : 1;
guint debug_enabled : 1;
guint forward_compatible : 1;
@ -450,6 +451,14 @@ gdk_gl_context_has_sync (GdkGLContext *context)
return priv->has_sync;
}
gboolean
gdk_gl_context_has_texture_format_bgra (GdkGLContext *context)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
return priv->has_texture_format_bgra;
}
/**
* gdk_gl_context_set_debug_enabled:
* @context: a #GdkGLContext
@ -819,6 +828,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
priv->has_unpack_subimage = epoxy_has_gl_extension ("GL_EXT_unpack_subimage");
priv->has_sync = priv->gl_version >= 30;
priv->has_texture_format_bgra = epoxy_has_gl_extension ("GL_EXT_texture_format_BGRA8888");
}
else
{