[gtk/master.win32: 2/5] gdkglcontext-win32.c: Create a global shared GL context




commit 1139c62c9f077131c38677f4deacddfcd032d9f6
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Jul 31 18:37:05 2020 +0800

    gdkglcontext-win32.c: Create a global shared GL context
    
    Like the other backends, we ought to create our WGL/EGL GL contexts like
    the following:
    
    "Create a global GL context that connects all GL contexts on a display
    and lets us share textures between them."

 gdk/win32/gdkglcontext-win32.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gdk/win32/gdkglcontext-win32.c b/gdk/win32/gdkglcontext-win32.c
index 056b651355..a500ffcddc 100644
--- a/gdk/win32/gdkglcontext-win32.c
+++ b/gdk/win32/gdkglcontext-win32.c
@@ -937,6 +937,7 @@ gdk_win32_gl_context_realize (GdkGLContext *context,
                               GError **error)
 {
   GdkGLContext *share = gdk_gl_context_get_shared_context (context);
+  GdkGLContext *shared_data_context;
   GdkWin32GLContext *context_win32 = GDK_WIN32_GL_CONTEXT (context);
 
   gboolean debug_bit, compat_bit, legacy_bit;
@@ -955,6 +956,7 @@ gdk_win32_gl_context_realize (GdkGLContext *context,
   gdk_gl_context_get_required_version (context, &major, &minor);
   debug_bit = gdk_gl_context_get_debug_enabled (context);
   compat_bit = gdk_gl_context_get_forward_compatible (context);
+  shared_data_context = gdk_surface_get_shared_data_gl_context (surface);
 
   /*
    * A legacy context cannot be shared with core profile ones, so this means we
@@ -1004,7 +1006,7 @@ gdk_win32_gl_context_realize (GdkGLContext *context,
                           legacy_bit ? "yes" : "no"));
 
       hglrc = _create_gl_context (context_win32->gl_hdc,
-                                  share,
+                                  share ? share : shared_data_context,
                                   flags,
                                   major,
                                   minor,
@@ -1046,7 +1048,7 @@ gdk_win32_gl_context_realize (GdkGLContext *context,
 
       ctx = _create_egl_context (win32_display->egl_disp,
                                  context_win32->egl_config,
-                                 share,
+                                 share ? share : shared_data_context,
                                  flags,
                                  major,
                                  minor,


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