diff options
author | Samuel Pitoiset <[email protected]> | 2017-07-18 11:25:32 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-07-31 13:53:39 +0200 |
commit | 81f3a6b29a6eef2b39279524f71ffcdf74fe05e3 (patch) | |
tree | a1adf997a51179e11cadc312089484ce94a9ca70 /src/mesa/main | |
parent | 8981f90091a3114fe20595c8957068a48fa85e9f (diff) |
mesa: add delete_sync() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/syncobj.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c index 62f6dbc4a60..6f7bfab42d3 100644 --- a/src/mesa/main/syncobj.c +++ b/src/mesa/main/syncobj.c @@ -223,10 +223,9 @@ _mesa_IsSync(GLsync sync) } -void GLAPIENTRY -_mesa_DeleteSync(GLsync sync) +static ALWAYS_INLINE void +delete_sync(struct gl_context *ctx, GLsync sync, bool no_error) { - GET_CURRENT_CONTEXT(ctx); struct gl_sync_object *syncObj; /* From the GL_ARB_sync spec: @@ -240,21 +239,30 @@ _mesa_DeleteSync(GLsync sync) } syncObj = _mesa_get_and_ref_sync(ctx, sync, true); - if (!syncObj) { - _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteSync (not a valid sync object)"); + if (!no_error && !syncObj) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glDeleteSync (not a valid sync object)"); return; } /* If there are no client-waits or server-waits pending on this sync, delete * the underlying object. Note that we double-unref the object, as - * _mesa_get_and_ref_sync above took an extra refcount to make sure the pointer - * is valid for us to manipulate. + * _mesa_get_and_ref_sync above took an extra refcount to make sure the + * pointer is valid for us to manipulate. */ syncObj->DeletePending = GL_TRUE; _mesa_unref_sync_object(ctx, syncObj, 2); } +void GLAPIENTRY +_mesa_DeleteSync(GLsync sync) +{ + GET_CURRENT_CONTEXT(ctx); + delete_sync(ctx, sync, false); +} + + static GLsync fence_sync(struct gl_context *ctx, GLenum condition, GLbitfield flags) { |