Mesa (master): mesa: remove NullBufferObj

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 6 15:04:56 UTC 2020


Module: Mesa
Branch: master
Commit: 58fab9a6fe258395d934b69c454f1b54bcefedf1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=58fab9a6fe258395d934b69c454f1b54bcefedf1

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Sat Mar 21 23:52:31 2020 -0400

mesa: remove NullBufferObj

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4466>

---

 src/mesa/main/bufferobj.c | 10 +++++++++-
 src/mesa/main/mtypes.h    |  3 ---
 src/mesa/main/shared.c    | 12 ------------
 src/mesa/main/varray.c    |  2 --
 4 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 4119f3ec92c..e4330d8c58e 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -4930,7 +4930,15 @@ _mesa_NamedBufferPageCommitmentEXT(GLuint buffer, GLintptr offset,
                                         "glNamedBufferPageCommitmentEXT"))
          return;
    } else {
-      bufferObj = ctx->Shared->NullBufferObj;
+      /* GL_EXT_direct_state_access says about NamedBuffer* functions:
+       *
+       *   There is no buffer corresponding to the name zero, these commands
+       *   generate the INVALID_OPERATION error if the buffer parameter is
+       *   zero.
+       */
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glNamedBufferPageCommitmentEXT(buffer = 0)");
+      return;
    }
    buffer_page_commitment(ctx, bufferObj, offset, size, commit,
                           "glNamedBufferPageCommitmentEXT");
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 33adf42ae54..50380c05b14 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -3313,9 +3313,6 @@ struct gl_shared_state
    GLuint TextureStateStamp;	        /**< state notification for shared tex */
    /*@}*/
 
-   /** Default buffer object for vertex arrays that aren't in VBOs */
-   struct gl_buffer_object *NullBufferObj;
-
    /**
     * \name Vertex/geometry/fragment programs
     */
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
index 3da48f3e747..46e2f9a1658 100644
--- a/src/mesa/main/shared.c
+++ b/src/mesa/main/shared.c
@@ -95,11 +95,6 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
    _mesa_init_shader_includes(shared);
    mtx_init(&shared->ShaderIncludeMutex, mtx_plain);
 
-   /* Allocate the default buffer object */
-   shared->NullBufferObj = ctx->Driver.NewBufferObject(ctx, 0);
-   if (!shared->NullBufferObj)
-      goto fail;
-
    /* Create default texture objects */
    for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
       /* NOTE: the order of these enums matches the TEXTURE_x_INDEX values */
@@ -143,10 +138,6 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
    shared->SemaphoreObjects = _mesa_NewHashTable();
 
    return shared;
-
-fail:
-   free_shared_state(ctx, shared);
-   return NULL;
 }
 
 
@@ -409,9 +400,6 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared)
       _mesa_DeleteHashTable(shared->RenderBuffers);
    }
 
-   if (shared->NullBufferObj)
-      _mesa_reference_buffer_object(ctx, &shared->NullBufferObj, NULL);
-
    if (shared->SyncObjects) {
       set_foreach(shared->SyncObjects, entry) {
          _mesa_unref_sync_object(ctx, (struct gl_sync_object *) entry->key, 1);
diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
index 7fa35879e58..357492583e6 100644
--- a/src/mesa/main/varray.c
+++ b/src/mesa/main/varray.c
@@ -204,8 +204,6 @@ _mesa_bind_vertex_buffer(struct gl_context *ctx,
    assert(!vao->SharedAndImmutable);
    struct gl_vertex_buffer_binding *binding = &vao->BufferBinding[index];
 
-   assert(vbo != ctx->Shared->NullBufferObj);
-
    if (ctx->Const.VertexBufferOffsetIsInt32 && (int)offset < 0 &&
        _mesa_is_bufferobj(vbo)) {
       /* The offset will be interpreted as a signed int, so make sure



More information about the mesa-commit mailing list