[Mesa-dev] [PATCH 064/101] mesa: add delete_buffers() helper

Samuel Pitoiset samuel.pitoiset at gmail.com
Fri Jul 21 17:40:13 UTC 2017


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/mesa/main/bufferobj.c | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 419972e371..a3b871f0ad 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -1265,21 +1265,14 @@ _mesa_BindBuffer(GLenum target, GLuint buffer)
  * \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) {
@@ -1410,6 +1403,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
-- 
2.13.3



More information about the mesa-dev mailing list