gltexture: Synchronize when downloading
authorMatthias Clasen <mclasen@redhat.com>
Mon, 30 Jan 2023 13:35:43 +0000 (08:35 -0500)
committerBenjamin Otte <otte@redhat.com>
Thu, 27 Apr 2023 04:57:02 +0000 (06:57 +0200)
If the GL texture has a sync object, wait
on it before downloading the data.

gdk/gdkgltexture.c

index 3b6c20a63789755be5096d2b4b6ed79ac772ee44..b409ae852d6d299434eabf08ba58d7490d1a54cd 100644 (file)
@@ -100,6 +100,10 @@ gdk_gl_texture_invoke_callback (gpointer data)
   context = gdk_display_get_gl_context (gdk_gl_context_get_display (invoke->self->context));
 
   gdk_gl_context_make_current (context);
+
+  if (invoke->self->sync && context != invoke->self->context)
+    glWaitSync (invoke->self->sync, 0, GL_TIMEOUT_IGNORED);
+
   glBindTexture (GL_TEXTURE_2D, invoke->self->id);
 
   invoke->func (invoke->self, context, invoke->data);