[Mesa-dev] [PATCH] mesa: Drop the "target" parameter from NewBufferObject().

Kenneth Graunke kenneth at whitecape.org
Wed Oct 15 14:06:48 PDT 2014


NewBufferObject took a "target" parameter, which it blindly passed to
_mesa_initialize_buffer_object(), which ignored it.

Not much point in passing it around.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i915/intel_buffer_objects.c    |  4 ++--
 src/mesa/drivers/dri/i965/intel_buffer_objects.c    |  4 ++--
 src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c    |  4 ++--
 src/mesa/drivers/dri/radeon/radeon_buffer_objects.c |  5 ++---
 src/mesa/main/bufferobj.c                           | 14 ++++++--------
 src/mesa/main/bufferobj.h                           |  2 +-
 src/mesa/main/dd.h                                  |  2 +-
 src/mesa/main/shared.c                              |  2 +-
 src/mesa/state_tracker/st_cb_bufferobjects.c        |  4 ++--
 src/mesa/vbo/vbo_exec_api.c                         |  2 +-
 src/mesa/vbo/vbo_save_api.c                         |  4 +---
 11 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_buffer_objects.c b/src/mesa/drivers/dri/i915/intel_buffer_objects.c
index 3da901b..ef06743 100644
--- a/src/mesa/drivers/dri/i915/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/i915/intel_buffer_objects.c
@@ -68,11 +68,11 @@ release_buffer(struct intel_buffer_object *intel_obj)
  * internal structure where somehow shared.
  */
 static struct gl_buffer_object *
-intel_bufferobj_alloc(struct gl_context * ctx, GLuint name, GLenum target)
+intel_bufferobj_alloc(struct gl_context * ctx, GLuint name)
 {
    struct intel_buffer_object *obj = CALLOC_STRUCT(intel_buffer_object);
 
-   _mesa_initialize_buffer_object(ctx, &obj->Base, name, target);
+   _mesa_initialize_buffer_object(ctx, &obj->Base, name);
 
    obj->buffer = NULL;
 
diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
index 82e0744..dd797e0 100644
--- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
@@ -133,14 +133,14 @@ release_buffer(struct intel_buffer_object *intel_obj)
  * internal structure where somehow shared.
  */
 static struct gl_buffer_object *
-intel_bufferobj_alloc(struct gl_context * ctx, GLuint name, GLenum target)
+intel_bufferobj_alloc(struct gl_context * ctx, GLuint name)
 {
    struct intel_buffer_object *obj = CALLOC_STRUCT(intel_buffer_object);
    if (!obj) {
       _mesa_error_no_memory(__func__);
    }
 
-   _mesa_initialize_buffer_object(ctx, &obj->Base, name, target);
+   _mesa_initialize_buffer_object(ctx, &obj->Base, name);
 
    obj->buffer = NULL;
 
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
index 2bb633e..afccf35 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_bufferobj.c
@@ -48,7 +48,7 @@ get_bufferobj_map(struct gl_context *ctx, struct gl_buffer_object *obj,
 }
 
 static struct gl_buffer_object *
-nouveau_bufferobj_new(struct gl_context *ctx, GLuint buffer, GLenum target)
+nouveau_bufferobj_new(struct gl_context *ctx, GLuint buffer)
 {
 	struct nouveau_bufferobj *nbo;
 
@@ -56,7 +56,7 @@ nouveau_bufferobj_new(struct gl_context *ctx, GLuint buffer, GLenum target)
 	if (!nbo)
 		return NULL;
 
-	_mesa_initialize_buffer_object(ctx, &nbo->base, buffer, target);
+	_mesa_initialize_buffer_object(ctx, &nbo->base, buffer);
 
 	return &nbo->base;
 }
diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
index 6294dbe..d9d4f5f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
+++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c
@@ -40,12 +40,11 @@ get_radeon_buffer_object(struct gl_buffer_object *obj)
 
 static struct gl_buffer_object *
 radeonNewBufferObject(struct gl_context * ctx,
-                      GLuint name,
-                      GLenum target)
+                      GLuint name)
 {
     struct radeon_buffer_object *obj = CALLOC_STRUCT(radeon_buffer_object);
 
-    _mesa_initialize_buffer_object(ctx, &obj->Base, name, target);
+    _mesa_initialize_buffer_object(ctx, &obj->Base, name);
 
     obj->bo = NULL;
 
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index b6879ce..2f15a41 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -389,14 +389,14 @@ convert_clear_buffer_data(struct gl_context *ctx,
  * Default callback for the \c dd_function_table::NewBufferObject() hook.
  */
 static struct gl_buffer_object *
-_mesa_new_buffer_object( struct gl_context *ctx, GLuint name, GLenum target )
+_mesa_new_buffer_object(struct gl_context *ctx, GLuint name)
 {
    struct gl_buffer_object *obj;
 
    (void) ctx;
 
    obj = MALLOC_STRUCT(gl_buffer_object);
-   _mesa_initialize_buffer_object(ctx, obj, name, target);
+   _mesa_initialize_buffer_object(ctx, obj, name);
    return obj;
 }
 
@@ -494,12 +494,10 @@ _mesa_reference_buffer_object_(struct gl_context *ctx,
  * Initialize a buffer object to default values.
  */
 void
-_mesa_initialize_buffer_object( struct gl_context *ctx,
-				struct gl_buffer_object *obj,
-				GLuint name, GLenum target )
+_mesa_initialize_buffer_object(struct gl_context *ctx,
+                               struct gl_buffer_object *obj,
+                               GLuint name)
 {
-   (void) target;
-
    memset(obj, 0, sizeof(struct gl_buffer_object));
    mtx_init(&obj->Mutex, mtx_plain);
    obj->RefCount = 1;
@@ -906,7 +904,7 @@ _mesa_handle_bind_buffer_gen(struct gl_context *ctx,
        * never used before, allocate a buffer object now.
        */
       ASSERT(ctx->Driver.NewBufferObject);
-      buf = ctx->Driver.NewBufferObject(ctx, buffer, target);
+      buf = ctx->Driver.NewBufferObject(ctx, buffer);
       if (!buf) {
 	 _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller);
 	 return false;
diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
index 0779605..fe294fc 100644
--- a/src/mesa/main/bufferobj.h
+++ b/src/mesa/main/bufferobj.h
@@ -103,7 +103,7 @@ _mesa_multi_bind_lookup_bufferobj(struct gl_context *ctx,
 extern void
 _mesa_initialize_buffer_object(struct gl_context *ctx,
                                struct gl_buffer_object *obj,
-                               GLuint name, GLenum target);
+                               GLuint name);
 
 extern void
 _mesa_reference_buffer_object_(struct gl_context *ctx,
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index c130b14..c07e83a 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -602,7 +602,7 @@ struct dd_function_table {
     */
    /*@{*/
    struct gl_buffer_object * (*NewBufferObject)(struct gl_context *ctx,
-                                                GLuint buffer, GLenum target);
+                                                GLuint buffer);
    
    void (*DeleteBuffer)( struct gl_context *ctx, struct gl_buffer_object *obj );
 
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
index 7ef932f..f74a823 100644
--- a/src/mesa/main/shared.c
+++ b/src/mesa/main/shared.c
@@ -86,7 +86,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
    shared->SamplerObjects = _mesa_NewHashTable();
 
    /* Allocate the default buffer object */
-   shared->NullBufferObj = ctx->Driver.NewBufferObject(ctx, 0, 0);
+   shared->NullBufferObj = ctx->Driver.NewBufferObject(ctx, 0);
 
    /* Create default texture objects */
    for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index d53602c..55f3644 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -54,14 +54,14 @@
  * internal structure where somehow shared.
  */
 static struct gl_buffer_object *
-st_bufferobj_alloc(struct gl_context *ctx, GLuint name, GLenum target)
+st_bufferobj_alloc(struct gl_context *ctx, GLuint name)
 {
    struct st_buffer_object *st_obj = ST_CALLOC_STRUCT(st_buffer_object);
 
    if (!st_obj)
       return NULL;
 
-   _mesa_initialize_buffer_object(ctx, &st_obj->Base, name, target);
+   _mesa_initialize_buffer_object(ctx, &st_obj->Base, name);
 
    return &st_obj->Base;
 }
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 2871100..5f8250e 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -997,7 +997,7 @@ void vbo_use_buffer_objects(struct gl_context *ctx)
 
    /* Allocate a real buffer object now */
    _mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL);
-   exec->vtx.bufferobj = ctx->Driver.NewBufferObject(ctx, bufName, target);
+   exec->vtx.bufferobj = ctx->Driver.NewBufferObject(ctx, bufName);
    if (!ctx->Driver.BufferData(ctx, target, size, NULL, usage,
                                GL_MAP_WRITE_BIT |
                                GL_DYNAMIC_STORAGE_BIT |
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index 1c6b919..848eeda 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -191,9 +191,7 @@ alloc_vertex_store(struct gl_context *ctx)
     * user.  Perhaps there could be a special number for internal
     * buffers:
     */
-   vertex_store->bufferobj = ctx->Driver.NewBufferObject(ctx,
-                                                         VBO_BUF_ID,
-                                                         GL_ARRAY_BUFFER_ARB);
+   vertex_store->bufferobj = ctx->Driver.NewBufferObject(ctx, VBO_BUF_ID);
    if (vertex_store->bufferobj) {
       save->out_of_memory =
          !ctx->Driver.BufferData(ctx,
-- 
2.1.2



More information about the mesa-dev mailing list