summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-06-26 14:48:24 +0200
committerSamuel Pitoiset <[email protected]>2017-06-28 10:25:13 +0200
commitdd71fd1dd3518c435fc3d143d80b844d77035cbc (patch)
tree7442cdca24187166fae5f9665a876fa2370b2524 /src
parent6e0cd291327a295714effbdd730068ae8843ba11 (diff)
mesa: add fence_sync() helper
Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/syncobj.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c
index 1347a0fcc4b..4278827b11d 100644
--- a/src/mesa/main/syncobj.c
+++ b/src/mesa/main/syncobj.c
@@ -258,24 +258,10 @@ _mesa_DeleteSync(GLsync sync)
}
-GLsync GLAPIENTRY
-_mesa_FenceSync(GLenum condition, GLbitfield flags)
+static GLsync
+fence_sync(struct gl_context *ctx, GLenum condition, GLbitfield flags)
{
- GET_CURRENT_CONTEXT(ctx);
struct gl_sync_object *syncObj;
- ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
-
- if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) {
- _mesa_error(ctx, GL_INVALID_ENUM, "glFenceSync(condition=0x%x)",
- condition);
- return 0;
- }
-
- if (flags != 0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glFenceSync(flags=0x%x)",
- condition);
- return 0;
- }
syncObj = ctx->Driver.NewSyncObject(ctx, GL_SYNC_FENCE);
if (syncObj != NULL) {
@@ -298,13 +284,35 @@ _mesa_FenceSync(GLenum condition, GLbitfield flags)
_mesa_set_add(ctx->Shared->SyncObjects, syncObj);
mtx_unlock(&ctx->Shared->Mutex);
- return (GLsync) syncObj;
+ return (GLsync)syncObj;
}
return NULL;
}
+GLsync GLAPIENTRY
+_mesa_FenceSync(GLenum condition, GLbitfield flags)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, 0);
+
+ if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glFenceSync(condition=0x%x)",
+ condition);
+ return 0;
+ }
+
+ if (flags != 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glFenceSync(flags=0x%x)",
+ condition);
+ return 0;
+ }
+
+ return fence_sync(ctx, condition, flags);
+}
+
+
static GLenum
client_wait_sync(struct gl_context *ctx, struct gl_sync_object *syncObj,
GLbitfield flags, GLuint64 timeout)