[gtk+] gl: Set legacy bit depending on OpenGL version



commit 31c05771e957f2f54fb197a391b63e6ef3394a26
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Fri Oct 21 21:21:39 2016 +0100

    gl: Set legacy bit depending on OpenGL version
    
    GDK defaults to asking for an OpenGL 3.2 Core Profile, but if we get a
    legacy profile from the underlying windowing system, the OpenGL version
    will be fixed to 3.0. If that happens, we need to set the legacy bit on
    the GdkGLContext, since that bit will be used to determine the version
    and type of GLSL shaders that will be used by application and toolkit
    code alike.

 gdk/gdkglcontext.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 248ce11..06cae69 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -811,6 +811,10 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
       priv->has_gl_framebuffer_blit = epoxy_has_gl_extension ("GL_EXT_framebuffer_blit");
       priv->has_frame_terminator = epoxy_has_gl_extension ("GL_GREMEDY_frame_terminator");
       priv->has_unpack_subimage = TRUE;
+
+      /* We asked for a core profile, but we didn't get one, so we're in legacy mode */
+      if (priv->gl_version < 32)
+        priv->is_legacy = TRUE;
     }
 
   if (!priv->use_es && G_UNLIKELY (_gdk_gl_flags & GDK_GL_TEXTURE_RECTANGLE))
@@ -823,7 +827,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
     g_warning ("GL implementation doesn't support any form of non-power-of-two textures");
 
   GDK_NOTE (OPENGL,
-            g_message ("%s version: %d.%d\n"
+            g_message ("%s version: %d.%d (%s)\n"
+                       "* GLSL version: %s\n"
                        "* Extensions checked:\n"
                        " - GL_ARB_texture_non_power_of_two: %s\n"
                        " - GL_ARB_texture_rectangle: %s\n"
@@ -832,6 +837,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
                        "* Using texture rectangle: %s",
                        priv->use_es ? "OpenGL ES" : "OpenGL",
                        priv->gl_version / 10, priv->gl_version % 10,
+                       priv->is_legacy ? "legacy" : "core",
+                       glGetString (GL_SHADING_LANGUAGE_VERSION),
                        has_npot ? "yes" : "no",
                        has_texture_rectangle ? "yes" : "no",
                        priv->has_gl_framebuffer_blit ? "yes" : "no",


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