aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/syncobj.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/syncobj.c')
-rw-r--r--mesalib/src/mesa/main/syncobj.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/mesalib/src/mesa/main/syncobj.c b/mesalib/src/mesa/main/syncobj.c
index 3157491bf..ae49db2e4 100644
--- a/mesalib/src/mesa/main/syncobj.c
+++ b/mesalib/src/mesa/main/syncobj.c
@@ -161,8 +161,16 @@ _mesa_free_sync_data(struct gl_context *ctx)
}
-int
-_mesa_validate_sync(struct gl_context *ctx, struct gl_sync_object *syncObj)
+/**
+ * Check if the given sync object is:
+ * - non-null
+ * - not in sync objects hash table
+ * - type is GL_SYNC_FENCE
+ * - not marked as deleted
+ */
+bool
+_mesa_validate_sync(struct gl_context *ctx,
+ const struct gl_sync_object *syncObj)
{
return (syncObj != NULL)
&& _mesa_set_search(ctx->Shared->SyncObjects,
@@ -410,7 +418,7 @@ _mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length,
return;
}
- if (size > 0) {
+ if (size > 0 && bufSize > 0) {
const GLsizei copy_count = MIN2(size, bufSize);
memcpy(values, v, sizeof(GLint) * copy_count);