[gtk/check-half-float: 1/2] gdk: Check OES_vertex_half_float GLES extension
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/check-half-float: 1/2] gdk: Check OES_vertex_half_float GLES extension
- Date: Thu, 5 May 2022 17:17:37 +0000 (UTC)
commit aba89fc000bc643fdb8a1fe0482f4f9b16deddbb
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 | 21 +++++++++++++++++----
gdk/gdkglcontextprivate.h | 2 ++
2 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 1678f3d85c..1f31a47673 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;
@@ -1525,11 +1526,13 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
{
priv->has_unpack_subimage = epoxy_has_gl_extension ("GL_EXT_unpack_subimage");
priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug");
+ priv->has_half_float = priv->gl_version / 10 >= 3 || epoxy_has_gl_extension ("OES_vertex_half_float");
}
else
{
priv->has_unpack_subimage = TRUE;
priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug");
+ priv->has_half_float = TRUE;
/* We asked for a core profile, but we didn't get one, so we're in legacy mode */
if (priv->gl_version < 32)
@@ -1547,13 +1550,15 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
"* 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 +1762,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 +1812,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]