egl: Support EGL_KHR_no_config_context

If the extension is supported, we create configless contexts.

This will come in handy real soon now, we use different configs for HDR
and SDR.
This commit is contained in:
Benjamin Otte 2021-10-06 02:41:31 +02:00
parent 3ca84c4357
commit bc7c0d05f8
3 changed files with 9 additions and 1 deletions

View File

@ -1698,6 +1698,8 @@ gdk_display_init_egl (GdkDisplay *self,
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_buffer_age");
self->have_egl_swap_buffers_with_damage =
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_swap_buffers_with_damage");
self->have_egl_no_config_context =
epoxy_has_egl_extension (priv->egl_display, "EGL_KHR_no_config_context");
GDK_DISPLAY_NOTE (self, OPENGL, {
char *ext = describe_extensions (priv->egl_display);

View File

@ -108,6 +108,7 @@ struct _GdkDisplay
/* egl info */
guint have_egl_buffer_age : 1;
guint have_egl_swap_buffers_with_damage : 1;
guint have_egl_no_config_context : 1;
};
struct _GdkDisplayClass

View File

@ -359,7 +359,7 @@ gdk_gl_context_real_realize (GdkGLContext *context,
if (egl_display)
{
EGLConfig egl_config = gdk_display_get_egl_config (display);
EGLConfig egl_config;
GdkGLContext *share = gdk_display_get_gl_context (display);
GdkGLContextPrivate *share_priv = gdk_gl_context_get_instance_private (share);
EGLContext ctx;
@ -377,6 +377,11 @@ gdk_gl_context_real_realize (GdkGLContext *context,
use_es = GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES) ||
(share != NULL && gdk_gl_context_get_use_es (share));
if (display->have_egl_no_config_context)
egl_config = NULL;
else
egl_config = gdk_display_get_egl_config (display);
flags = 0;
if (debug_bit)