From 20ff1f9db7fc5f5ed5298a8dce9f2dac431ca2dd Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 26 Jun 2017 14:42:54 +0200 Subject: mesa: add client_wait_sync() helper Signed-off-by: Samuel Pitoiset Reviewed-by: Timothy Arceri --- src/mesa/main/syncobj.c | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c index a3124e40056..ce9c99725ea 100644 --- a/src/mesa/main/syncobj.c +++ b/src/mesa/main/syncobj.c @@ -305,24 +305,11 @@ _mesa_FenceSync(GLenum condition, GLbitfield flags) } -GLenum GLAPIENTRY -_mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) +static GLenum +client_wait_sync(struct gl_context *ctx, struct gl_sync_object *syncObj, + GLbitfield flags, GLuint64 timeout) { - GET_CURRENT_CONTEXT(ctx); - struct gl_sync_object *syncObj; GLenum ret; - ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_WAIT_FAILED); - - if ((flags & ~GL_SYNC_FLUSH_COMMANDS_BIT) != 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glClientWaitSync(flags=0x%x)", flags); - return GL_WAIT_FAILED; - } - - syncObj = _mesa_get_and_ref_sync(ctx, sync, true); - if (!syncObj) { - _mesa_error(ctx, GL_INVALID_VALUE, "glClientWaitSync (not a valid sync object)"); - return GL_WAIT_FAILED; - } /* From the GL_ARB_sync spec: * @@ -349,6 +336,29 @@ _mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) } +GLenum GLAPIENTRY +_mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_sync_object *syncObj; + + ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_WAIT_FAILED); + + if ((flags & ~GL_SYNC_FLUSH_COMMANDS_BIT) != 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glClientWaitSync(flags=0x%x)", flags); + return GL_WAIT_FAILED; + } + + syncObj = _mesa_get_and_ref_sync(ctx, sync, true); + if (!syncObj) { + _mesa_error(ctx, GL_INVALID_VALUE, "glClientWaitSync (not a valid sync object)"); + return GL_WAIT_FAILED; + } + + return client_wait_sync(ctx, syncObj, flags, timeout); +} + + void GLAPIENTRY _mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) { -- cgit v1.2.3