diff options
author | Samuel Pitoiset <[email protected]> | 2017-07-19 13:32:28 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-07-31 13:53:39 +0200 |
commit | fc039e9ff429437f6b14a2bddee9245d1b8c3a22 (patch) | |
tree | b2bd9a8cf07700a1385c0e50b3736ad2ad89cfb2 | |
parent | 7bc50dfe79ae4ff48bf5b635e0291702db990e4e (diff) |
mesa: add delete_buffers() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
-rw-r--r-- | src/mesa/main/bufferobj.c | 27 |
1 files changed, 17 insertions, 10 deletions
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 |