[gtk/wip/otte/gl-hdr: 15/18] egl: Support EGL_KHR_no_config_context




commit bc7c0d05f8ac6e02d256795706aecf169f9cd702
Author: Benjamin Otte <otte redhat com>
Date:   Wed Oct 6 02:41:31 2021 +0200

    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.

 gdk/gdkdisplay.c        | 2 ++
 gdk/gdkdisplayprivate.h | 1 +
 gdk/gdkglcontext.c      | 7 ++++++-
 3 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index c3aed432a1..cedd0856bc 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -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);
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
index 8c92f42679..3b7a18f4b3 100644
--- a/gdk/gdkdisplayprivate.h
+++ b/gdk/gdkdisplayprivate.h
@@ -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
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 527ef62773..0fc8b689cc 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]