Fix texture tests with GLES
authorMatthias Clasen <mclasen@redhat.com>
Mon, 15 May 2023 23:11:35 +0000 (19:11 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 15 May 2023 23:11:35 +0000 (19:11 -0400)
No sync for you if you're using GLES.

testsuite/gdk/gltexture.c

index f1145647c3400ac8a543f4204761a42d214f289a..cb00e842ff625818a5942592f6851041fc272845 100644 (file)
@@ -1,6 +1,7 @@
 #include <gtk/gtk.h>
 #include <epoxy/gl.h>
 #include "gdk/gdktextureprivate.h"
+#include "gdk/gdkglcontextprivate.h"
 
 static cairo_surface_t *
 make_surface (void)
@@ -177,7 +178,10 @@ G_GNUC_END_IGNORE_DEPRECATIONS
 
   id = make_gl_texture (context, surface);
 
-  sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+  if (gdk_gl_context_has_sync (context))
+    sync = glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
+  else
+    sync = NULL;
 
   update_region = cairo_region_create_rectangle (&(cairo_rectangle_int_t) { 10, 10, 32, 32 });
 
@@ -219,7 +223,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS
 
   cairo_surface_destroy (surface);
 
-  glDeleteSync (sync);
+  if (sync)
+    glDeleteSync (sync);
   cairo_region_destroy (update_region);
   g_object_unref (old_texture);