summaryrefslogtreecommitdiff
path: root/gsk/gl/gskglcommandqueueprivate.h
diff options
context:
space:
mode:
Diffstat (limited to 'gsk/gl/gskglcommandqueueprivate.h')
-rw-r--r--gsk/gl/gskglcommandqueueprivate.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/gsk/gl/gskglcommandqueueprivate.h b/gsk/gl/gskglcommandqueueprivate.h
index fd72f68aff..df3afb1eea 100644
--- a/gsk/gl/gskglcommandqueueprivate.h
+++ b/gsk/gl/gskglcommandqueueprivate.h
@@ -168,9 +168,15 @@ typedef union _GskGLCommandBatch
G_STATIC_ASSERT (sizeof (GskGLCommandBatch) == 32);
+typedef struct _GskGLSync {
+ guint id;
+ gpointer sync;
+} GskGLSync;
+
DEFINE_INLINE_ARRAY (GskGLCommandBatches, gsk_gl_command_batches, GskGLCommandBatch)
DEFINE_INLINE_ARRAY (GskGLCommandBinds, gsk_gl_command_binds, GskGLCommandBind)
DEFINE_INLINE_ARRAY (GskGLCommandUniforms, gsk_gl_command_uniforms, GskGLCommandUniform)
+DEFINE_INLINE_ARRAY (GskGLSyncs, gsk_gl_syncs, GskGLSync)
struct _GskGLCommandQueue
{
@@ -233,6 +239,10 @@ struct _GskGLCommandQueue
*/
GLuint samplers[GSK_GL_N_FILTERS * GSK_GL_N_FILTERS];
+ /* Array of sync objects to wait on.
+ */
+ GskGLSyncs syncs;
+
/* Discovered max texture size when loading the command queue so that we
* can either scale down or slice textures to fit within this size. Assumed
* to be both height and width.
@@ -371,5 +381,36 @@ gsk_gl_command_queue_bind_framebuffer (GskGLCommandQueue *self,
return ret;
}
+static inline GskGLSync *
+gsk_gl_syncs_get_sync (GskGLSyncs *syncs,
+ guint id)
+{
+ for (unsigned int i = 0; i < syncs->len; i++)
+ {
+ GskGLSync *sync = &syncs->items[i];
+ if (sync->id == id)
+ return sync;
+ }
+ return NULL;
+}
+
+static inline void
+gsk_gl_syncs_add_sync (GskGLSyncs *syncs,
+ guint id,
+ gpointer sync)
+{
+ GskGLSync *s;
+
+ s = gsk_gl_syncs_get_sync (syncs, id);
+ if (s)
+ g_assert (s->sync == sync);
+ else
+ {
+ s = gsk_gl_syncs_append (syncs);
+ s->id = id;
+ s->sync = sync;
+ }
+}
+
G_END_DECLS