[gtk+/wip/ebassi/legacy-gl: 8/11] Control legacy GL context via environment variable



commit 72cec888e702bb42aa274fe5668775a55a3fc439
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Tue Oct 6 19:57:45 2015 +0100

    Control legacy GL context via environment variable
    
    For testing purposes, we may want to force the creation of legacy GL
    contexts via an environment variable.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=756142

 gdk/gdk.c                  |    1 +
 gdk/gdkinternals.h         |    3 ++-
 gdk/x11/gdkglcontext-x11.c |    3 ++-
 3 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdk.c b/gdk/gdk.c
index d86ea85..25e6287 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -144,6 +144,7 @@ static const GDebugKey gdk_gl_keys[] = {
   {"software-draw-gl",      GDK_GL_SOFTWARE_DRAW_GL},
   {"software-draw-surface", GDK_GL_SOFTWARE_DRAW_SURFACE},
   {"texture-rectangle",     GDK_GL_TEXTURE_RECTANGLE},
+  {"legacy",                GDK_GL_LEGACY},
 };
 
 #ifdef G_ENABLE_DEBUG
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 718a02d..b75eb3a 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -99,7 +99,8 @@ typedef enum {
   GDK_GL_ALWAYS                 = 1 << 1,
   GDK_GL_SOFTWARE_DRAW_GL       = 1 << 2,
   GDK_GL_SOFTWARE_DRAW_SURFACE  = 1 << 3,
-  GDK_GL_TEXTURE_RECTANGLE      = 1 << 4
+  GDK_GL_TEXTURE_RECTANGLE      = 1 << 4,
+  GDK_GL_LEGACY                 = 1 << 5
 } GdkGLFlags;
 
 extern GList            *_gdk_default_filters;
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index 65303fe..ce462ad 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -638,7 +638,8 @@ gdk_x11_gl_context_realize (GdkGLContext  *context,
   compat_bit = gdk_gl_context_get_forward_compatible (context);
 
   /* If there is no glXCreateContextAttribsARB() then we default to legacy */
-  legacy_bit = !GDK_X11_DISPLAY (display)->has_glx_create_context;
+  legacy_bit = !GDK_X11_DISPLAY (display)->has_glx_create_context ||
+               (_gdk_gl_flags & GDK_GL_LEGACY) != 0;
 
   /* We cannot share legacy contexts with core profile ones, so the
    * shared context is the one that decides if we're going to create


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