From: Samuel Pitoiset Date: Mon, 26 Jun 2017 12:42:54 +0000 (+0200) Subject: mesa: add client_wait_sync() helper X-Git-Tag: upstream/18.1.0~8237 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=20ff1f9db7fc5f5ed5298a8dce9f2dac431ca2dd;p=platform%2Fupstream%2Fmesa.git mesa: add client_wait_sync() helper Signed-off-by: Samuel Pitoiset Reviewed-by: Timothy Arceri --- diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c index a3124e4..ce9c997 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) {