[gtk/win32-gl-improvements: 12/14] gdkglcontext.c: Ensure EGL contexts are in-sync with shared context




commit 4b972ababba1901681f6bb38659ce724764f43bd
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Jan 17 17:27:10 2022 +0800

    gdkglcontext.c: Ensure EGL contexts are in-sync with shared context
    
    The EGL context that we are actually creating must have matching OpenGL/ES
    versions and allowed GL API set with the previously-created EGL context
    that will be shared with it so that they can interoperate together, if
    applicable.
    
    This will fix the situation by making sure that we request for the
    OpenGL/ES version and OpenGL API set that match with what we have in our shared
    EGL context.  Otherwise, the newly-created EGL context assumed a OpenGL/ES 2.0
    context that supported desktop OpenGL, which may not be what we wanted, such as
    in the case of libANGLE.

 gdk/gdkglcontext.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 3c5e4ffdb1..531344b72e 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -278,7 +278,15 @@ gdk_gl_context_real_realize (GdkGLContext  *context,
       int i = 0;
       G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
 
-      gdk_gl_context_get_required_version (context, &major, &minor);
+      if (share != NULL)
+        {
+          gdk_gl_context_get_required_version (share, &major, &minor);
+          gdk_gl_context_set_allowed_apis (context,
+                                           gdk_gl_context_get_allowed_apis (share));
+        }
+      else
+        gdk_gl_context_get_required_version (context, &major, &minor);
+
       debug_bit = gdk_gl_context_get_debug_enabled (context);
       forward_bit = gdk_gl_context_get_forward_compatible (context);
       legacy_bit = GDK_DISPLAY_DEBUG_CHECK (display, GL_LEGACY) ||


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