[gtk/gtk-4-6] gdk: Check OES_vertex_half_float GLES extension



commit 55a4b4a174ef2bd891cc689df01ba3bb1f76b77d
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu May 5 13:08:32 2022 -0400

    gdk: Check OES_vertex_half_float GLES extension
    
    This will be checked in the GL renderer.

 gdk/gdkglcontext.c        | 22 ++++++++++++++++++----
 gdk/gdkglcontextprivate.h |  2 ++
 2 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 1678f3d85c..1591cbd3ad 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -1,7 +1,7 @@
 /* GDK - The GIMP Drawing Kit
  *
  * gdkglcontext.c: GL context abstraction
- * 
+ *
  * Copyright © 2014  Emmanuele Bassi
  *
  * This library is free software; you can redistribute it and/or
@@ -103,6 +103,7 @@ typedef struct {
 
   guint has_khr_debug : 1;
   guint use_khr_debug : 1;
+  guint has_half_float : 1;
   guint has_unpack_subimage : 1;
   guint has_debug_output : 1;
   guint extensions_checked : 1;
@@ -1542,18 +1543,23 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
       glGetIntegerv (GL_MAX_LABEL_LENGTH, &priv->max_debug_label_length);
     }
 
+  priv->has_half_float = gdk_gl_context_check_version (context, 3, 0, 3, 0) ||
+                         epoxy_has_gl_extension ("OES_vertex_half_float");
+
   GDK_DISPLAY_NOTE (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), OPENGL,
     g_message ("%s version: %d.%d (%s)\n"
                        "* GLSL version: %s\n"
                        "* Extensions checked:\n"
                        " - GL_KHR_debug: %s\n"
-                       " - GL_EXT_unpack_subimage: %s",
+                       " - GL_EXT_unpack_subimage: %s\n"
+                       " - OES_vertex_half_float: %s",
                        gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
                        priv->gl_version / 10, priv->gl_version % 10,
                        priv->is_legacy ? "legacy" : "core",
                        glGetString (GL_SHADING_LANGUAGE_VERSION),
                        priv->has_khr_debug ? "yes" : "no",
-                       priv->has_unpack_subimage ? "yes" : "no"));
+                       priv->has_unpack_subimage ? "yes" : "no",
+                       priv->has_half_float ? "yes" : "no"));
 
   priv->extensions_checked = TRUE;
 }
@@ -1757,6 +1763,14 @@ gdk_gl_context_has_debug (GdkGLContext *self)
   return priv->debug_enabled || priv->use_khr_debug;
 }
 
+gboolean
+gdk_gl_context_has_vertex_half_float (GdkGLContext *self)
+{
+  GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
+
+  return priv->has_half_float;
+}
+
 /* This is currently private! */
 /* When using GL/ES, don't flip the 'R' and 'B' bits on Windows/ANGLE for glReadPixels() */
 gboolean
@@ -1799,7 +1813,7 @@ gboolean
 gdk_gl_backend_can_be_used (GdkGLBackend   backend_type,
                             GError       **error)
 {
-  if (the_gl_backend_type == GDK_GL_NONE || 
+  if (the_gl_backend_type == GDK_GL_NONE ||
       the_gl_backend_type == backend_type)
     return TRUE;
 
diff --git a/gdk/gdkglcontextprivate.h b/gdk/gdkglcontextprivate.h
index 0a3739f090..cd58c30b4e 100644
--- a/gdk/gdkglcontextprivate.h
+++ b/gdk/gdkglcontextprivate.h
@@ -139,6 +139,8 @@ gboolean                gdk_gl_context_has_debug                (GdkGLContext
 
 gboolean                gdk_gl_context_use_es_bgra              (GdkGLContext    *context);
 
+gboolean                gdk_gl_context_has_vertex_half_float    (GdkGLContext    *self) G_GNUC_PURE;
+
 G_END_DECLS
 
 #endif /* __GDK_GL_CONTEXT_PRIVATE_H__ */


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