summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2023-04-26 11:59:51 +0200
committerMatthias Clasen <mclasen@redhat.com>2023-04-26 11:59:51 +0200
commit7fe48792eeb054fa79b9a98723896af2eeaf0c42 (patch)
tree1f8acab2622cfb281253e82824d70360ea11f157
parent57a75f760d49ed276f3f87167a582a5cd4e5046a (diff)
downloadgtk+-7fe48792eeb054fa79b9a98723896af2eeaf0c42.tar.gz
glcontext: Add a way to check for fence sync
-rw-r--r--gdk/gdkglcontext.c19
-rw-r--r--gdk/gdkglcontextprivate.h2
2 files changed, 19 insertions, 2 deletions
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index 8d38a0c50f..6d46a755f1 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -106,6 +106,7 @@ typedef struct {
guint has_khr_debug : 1;
guint use_khr_debug : 1;
guint has_half_float : 1;
+ guint has_fence_sync : 1;
guint has_unpack_subimage : 1;
guint has_debug_output : 1;
guint extensions_checked : 1;
@@ -1557,6 +1558,10 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
priv->has_half_float = gdk_gl_context_check_version (context, 3, 0, 3, 0) ||
epoxy_has_gl_extension ("OES_vertex_half_float");
+ priv->has_fence_sync = gdk_gl_context_check_version (context, 3, 2, 3, 0) ||
+ epoxy_has_gl_extension ("GL_ARB_sync") ||
+ epoxy_has_gl_extension ("GK_APPLE_sync");
+
#ifdef G_ENABLE_DEBUG
{
int max_texture_size;
@@ -1568,7 +1573,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
"* Extensions checked:\n"
" - GL_KHR_debug: %s\n"
" - GL_EXT_unpack_subimage: %s\n"
- " - OES_vertex_half_float: %s",
+ " - half float: %s\n"
+ " - fence sync: %s",
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
priv->gl_version / 10, priv->gl_version % 10,
priv->is_legacy ? "legacy" : "core",
@@ -1576,7 +1582,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
max_texture_size,
priv->has_khr_debug ? "yes" : "no",
priv->has_unpack_subimage ? "yes" : "no",
- priv->has_half_float ? "yes" : "no");
+ priv->has_half_float ? "yes" : "no",
+ priv->has_fence_sync ? "yes" : "no");
}
#endif
@@ -1808,6 +1815,14 @@ gdk_gl_context_has_vertex_half_float (GdkGLContext *self)
return priv->has_half_float;
}
+gboolean
+gdk_gl_context_has_fence_sync (GdkGLContext *self)
+{
+ GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
+
+ return priv->has_fence_sync;
+}
+
/* This is currently private! */
/* When using GL/ES, don't flip the 'R' and 'B' bits on Windows/ANGLE for glReadPixels() */
gboolean
diff --git a/gdk/gdkglcontextprivate.h b/gdk/gdkglcontextprivate.h
index ac20742ea9..ea60fa3307 100644
--- a/gdk/gdkglcontextprivate.h
+++ b/gdk/gdkglcontextprivate.h
@@ -162,6 +162,8 @@ gboolean gdk_gl_context_use_es_bgra (GdkGLContext
gboolean gdk_gl_context_has_vertex_half_float (GdkGLContext *self) G_GNUC_PURE;
+gboolean gdk_gl_context_has_fence_sync (GdkGLContext *self) G_GNUC_PURE;
+
double gdk_gl_context_get_scale (GdkGLContext *self);
G_END_DECLS