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 <kenneth@whitecape.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Kenneth Graunke
2014-10-15 13:00:39 -07:00
parent af31f930ab
commit 63c6509ad2
11 changed files with 21 additions and 26 deletions

View File

@@ -68,11 +68,11 @@ release_buffer(struct intel_buffer_object *intel_obj)
* internal structure where somehow shared. * internal structure where somehow shared.
*/ */
static struct gl_buffer_object * 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); 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; obj->buffer = NULL;

View File

@@ -138,14 +138,14 @@ release_buffer(struct intel_buffer_object *intel_obj)
* internal structure where somehow shared. * internal structure where somehow shared.
*/ */
static struct gl_buffer_object * 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); struct intel_buffer_object *obj = CALLOC_STRUCT(intel_buffer_object);
if (!obj) { if (!obj) {
_mesa_error_no_memory(__func__); _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; obj->buffer = NULL;

View File

@@ -48,7 +48,7 @@ get_bufferobj_map(struct gl_context *ctx, struct gl_buffer_object *obj,
} }
static struct gl_buffer_object * 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; struct nouveau_bufferobj *nbo;
@@ -56,7 +56,7 @@ nouveau_bufferobj_new(struct gl_context *ctx, GLuint buffer, GLenum target)
if (!nbo) if (!nbo)
return NULL; return NULL;
_mesa_initialize_buffer_object(ctx, &nbo->base, buffer, target); _mesa_initialize_buffer_object(ctx, &nbo->base, buffer);
return &nbo->base; return &nbo->base;
} }

View File

@@ -40,12 +40,11 @@ get_radeon_buffer_object(struct gl_buffer_object *obj)
static struct gl_buffer_object * static struct gl_buffer_object *
radeonNewBufferObject(struct gl_context * ctx, radeonNewBufferObject(struct gl_context * ctx,
GLuint name, GLuint name)
GLenum target)
{ {
struct radeon_buffer_object *obj = CALLOC_STRUCT(radeon_buffer_object); 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; obj->bo = NULL;

View File

@@ -389,14 +389,14 @@ convert_clear_buffer_data(struct gl_context *ctx,
* Default callback for the \c dd_function_table::NewBufferObject() hook. * Default callback for the \c dd_function_table::NewBufferObject() hook.
*/ */
static struct gl_buffer_object * 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; struct gl_buffer_object *obj;
(void) ctx; (void) ctx;
obj = MALLOC_STRUCT(gl_buffer_object); obj = MALLOC_STRUCT(gl_buffer_object);
_mesa_initialize_buffer_object(ctx, obj, name, target); _mesa_initialize_buffer_object(ctx, obj, name);
return obj; return obj;
} }
@@ -496,10 +496,8 @@ _mesa_reference_buffer_object_(struct gl_context *ctx,
void void
_mesa_initialize_buffer_object(struct gl_context *ctx, _mesa_initialize_buffer_object(struct gl_context *ctx,
struct gl_buffer_object *obj, struct gl_buffer_object *obj,
GLuint name, GLenum target ) GLuint name)
{ {
(void) target;
memset(obj, 0, sizeof(struct gl_buffer_object)); memset(obj, 0, sizeof(struct gl_buffer_object));
mtx_init(&obj->Mutex, mtx_plain); mtx_init(&obj->Mutex, mtx_plain);
obj->RefCount = 1; obj->RefCount = 1;
@@ -906,7 +904,7 @@ _mesa_handle_bind_buffer_gen(struct gl_context *ctx,
* never used before, allocate a buffer object now. * never used before, allocate a buffer object now.
*/ */
ASSERT(ctx->Driver.NewBufferObject); ASSERT(ctx->Driver.NewBufferObject);
buf = ctx->Driver.NewBufferObject(ctx, buffer, target); buf = ctx->Driver.NewBufferObject(ctx, buffer);
if (!buf) { if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller); _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller);
return false; return false;

View File

@@ -103,7 +103,7 @@ _mesa_multi_bind_lookup_bufferobj(struct gl_context *ctx,
extern void extern void
_mesa_initialize_buffer_object(struct gl_context *ctx, _mesa_initialize_buffer_object(struct gl_context *ctx,
struct gl_buffer_object *obj, struct gl_buffer_object *obj,
GLuint name, GLenum target); GLuint name);
extern void extern void
_mesa_reference_buffer_object_(struct gl_context *ctx, _mesa_reference_buffer_object_(struct gl_context *ctx,

View File

@@ -602,7 +602,7 @@ struct dd_function_table {
*/ */
/*@{*/ /*@{*/
struct gl_buffer_object * (*NewBufferObject)(struct gl_context *ctx, 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 ); void (*DeleteBuffer)( struct gl_context *ctx, struct gl_buffer_object *obj );

View File

@@ -86,7 +86,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
shared->SamplerObjects = _mesa_NewHashTable(); shared->SamplerObjects = _mesa_NewHashTable();
/* Allocate the default buffer object */ /* Allocate the default buffer object */
shared->NullBufferObj = ctx->Driver.NewBufferObject(ctx, 0, 0); shared->NullBufferObj = ctx->Driver.NewBufferObject(ctx, 0);
/* Create default texture objects */ /* Create default texture objects */
for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {

View File

@@ -54,14 +54,14 @@
* internal structure where somehow shared. * internal structure where somehow shared.
*/ */
static struct gl_buffer_object * 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); struct st_buffer_object *st_obj = ST_CALLOC_STRUCT(st_buffer_object);
if (!st_obj) if (!st_obj)
return NULL; 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; return &st_obj->Base;
} }

View File

@@ -997,7 +997,7 @@ void vbo_use_buffer_objects(struct gl_context *ctx)
/* Allocate a real buffer object now */ /* Allocate a real buffer object now */
_mesa_reference_buffer_object(ctx, &exec->vtx.bufferobj, NULL); _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, if (!ctx->Driver.BufferData(ctx, target, size, NULL, usage,
GL_MAP_WRITE_BIT | GL_MAP_WRITE_BIT |
GL_DYNAMIC_STORAGE_BIT | GL_DYNAMIC_STORAGE_BIT |

View File

@@ -191,9 +191,7 @@ alloc_vertex_store(struct gl_context *ctx)
* user. Perhaps there could be a special number for internal * user. Perhaps there could be a special number for internal
* buffers: * buffers:
*/ */
vertex_store->bufferobj = ctx->Driver.NewBufferObject(ctx, vertex_store->bufferobj = ctx->Driver.NewBufferObject(ctx, VBO_BUF_ID);
VBO_BUF_ID,
GL_ARRAY_BUFFER_ARB);
if (vertex_store->bufferobj) { if (vertex_store->bufferobj) {
save->out_of_memory = save->out_of_memory =
!ctx->Driver.BufferData(ctx, !ctx->Driver.BufferData(ctx,