From: Samuel Pitoiset Date: Wed, 19 Jul 2017 11:32:28 +0000 (+0200) Subject: mesa: add delete_buffers() helper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fc039e9ff429437f6b14a2bddee9245d1b8c3a22;p=mesa.git mesa: add delete_buffers() helper Signed-off-by: Samuel Pitoiset Reviewed-by: Timothy Arceri --- diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index cd561a0a271..ff1357df341 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1468,21 +1468,14 @@ bind_atomic_buffer(struct gl_context *ctx, unsigned index, * \param n Number of buffer objects to delete. * \param ids Array of \c n buffer object IDs. */ -void GLAPIENTRY -_mesa_DeleteBuffers(GLsizei n, const GLuint *ids) +static void +delete_buffers(struct gl_context *ctx, GLsizei n, const GLuint *ids) { - GET_CURRENT_CONTEXT(ctx); - GLsizei i; FLUSH_VERTICES(ctx, 0); - if (n < 0) { - _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteBuffersARB(n)"); - return; - } - _mesa_HashLockMutex(ctx->Shared->BufferObjects); - for (i = 0; i < n; i++) { + for (GLsizei i = 0; i < n; i++) { struct gl_buffer_object *bufObj = _mesa_lookup_bufferobj_locked(ctx, ids[i]); if (bufObj) { @@ -1619,6 +1612,20 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids) } +void GLAPIENTRY +_mesa_DeleteBuffers(GLsizei n, const GLuint *ids) +{ + GET_CURRENT_CONTEXT(ctx); + + if (n < 0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glDeleteBuffersARB(n)"); + return; + } + + delete_buffers(ctx, n, ids); +} + + /** * This is the implementation for glGenBuffers and glCreateBuffers. It is not * exposed to the rest of Mesa to encourage the use of nameless buffers in