From 63c6509ad2e2707cca0ff3ba6fbc5582c3e2eea5 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Wed, 15 Oct 2014 13:00:39 -0700 Subject: [PATCH] mesa: Drop the "target" parameter from NewBufferObject(). 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 Reviewed-by: Brian Paul Reviewed-by: Ian Romanick --- 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 ++-- .../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 3da901b87b4..ef06743ed49 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 50523fee317..b4eb0765a10 100644 --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c @@ -138,14 +138,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 2bb633e1047..afccf353960 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 6294dbe1f98..d9d4f5ffc5e 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 d6483080c6e..0ee88560ffd 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 0779605c08b..fe294fc0bed 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 c130b14a522..c07e83ad911 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 7ef932ff052..f74a8232f43 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 d53602c8b5a..55f36442a07 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 2871100aeab..5f8250e78c7 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 1c6b91942d5..848eedaa4e5 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.30.2