mesa: rename some vars in arrayobj.c

Use 'vao' instead of 'obj' to be consistent with other code.
Plus, add a comment.

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
This commit is contained in:
Brian Paul 2016-10-06 17:16:51 -06:00
parent b81546d43c
commit c328268b92
1 changed files with 31 additions and 24 deletions

View File

@ -223,13 +223,20 @@ _mesa_reference_vao_(struct gl_context *ctx,
} }
/**
* Initialize attribtes of a vertex array within a vertex array object.
* \param vao the container vertex array object
* \param index which array in the VAO to initialize
* \param size number of components (1, 2, 3 or 4) per attribute
* \param type datatype of the attribute (GL_FLOAT, GL_INT, etc).
*/
static void static void
init_array(struct gl_context *ctx, init_array(struct gl_context *ctx,
struct gl_vertex_array_object *obj, GLuint index, GLint size, GLint type) struct gl_vertex_array_object *vao,
GLuint index, GLint size, GLint type)
{ {
struct gl_vertex_attrib_array *array = &obj->VertexAttrib[index]; struct gl_vertex_attrib_array *array = &vao->VertexAttrib[index];
struct gl_vertex_buffer_binding *binding = &obj->VertexBinding[index]; struct gl_vertex_buffer_binding *binding = &vao->VertexBinding[index];
array->Size = size; array->Size = size;
array->Type = type; array->Type = type;
@ -260,47 +267,47 @@ init_array(struct gl_context *ctx,
*/ */
void void
_mesa_initialize_vao(struct gl_context *ctx, _mesa_initialize_vao(struct gl_context *ctx,
struct gl_vertex_array_object *obj, struct gl_vertex_array_object *vao,
GLuint name) GLuint name)
{ {
GLuint i; GLuint i;
obj->Name = name; vao->Name = name;
mtx_init(&obj->Mutex, mtx_plain); mtx_init(&vao->Mutex, mtx_plain);
obj->RefCount = 1; vao->RefCount = 1;
/* Init the individual arrays */ /* Init the individual arrays */
for (i = 0; i < ARRAY_SIZE(obj->VertexAttrib); i++) { for (i = 0; i < ARRAY_SIZE(vao->VertexAttrib); i++) {
switch (i) { switch (i) {
case VERT_ATTRIB_WEIGHT: case VERT_ATTRIB_WEIGHT:
init_array(ctx, obj, VERT_ATTRIB_WEIGHT, 1, GL_FLOAT); init_array(ctx, vao, VERT_ATTRIB_WEIGHT, 1, GL_FLOAT);
break; break;
case VERT_ATTRIB_NORMAL: case VERT_ATTRIB_NORMAL:
init_array(ctx, obj, VERT_ATTRIB_NORMAL, 3, GL_FLOAT); init_array(ctx, vao, VERT_ATTRIB_NORMAL, 3, GL_FLOAT);
break; break;
case VERT_ATTRIB_COLOR1: case VERT_ATTRIB_COLOR1:
init_array(ctx, obj, VERT_ATTRIB_COLOR1, 3, GL_FLOAT); init_array(ctx, vao, VERT_ATTRIB_COLOR1, 3, GL_FLOAT);
break; break;
case VERT_ATTRIB_FOG: case VERT_ATTRIB_FOG:
init_array(ctx, obj, VERT_ATTRIB_FOG, 1, GL_FLOAT); init_array(ctx, vao, VERT_ATTRIB_FOG, 1, GL_FLOAT);
break; break;
case VERT_ATTRIB_COLOR_INDEX: case VERT_ATTRIB_COLOR_INDEX:
init_array(ctx, obj, VERT_ATTRIB_COLOR_INDEX, 1, GL_FLOAT); init_array(ctx, vao, VERT_ATTRIB_COLOR_INDEX, 1, GL_FLOAT);
break; break;
case VERT_ATTRIB_EDGEFLAG: case VERT_ATTRIB_EDGEFLAG:
init_array(ctx, obj, VERT_ATTRIB_EDGEFLAG, 1, GL_BOOL); init_array(ctx, vao, VERT_ATTRIB_EDGEFLAG, 1, GL_BOOL);
break; break;
case VERT_ATTRIB_POINT_SIZE: case VERT_ATTRIB_POINT_SIZE:
init_array(ctx, obj, VERT_ATTRIB_POINT_SIZE, 1, GL_FLOAT); init_array(ctx, vao, VERT_ATTRIB_POINT_SIZE, 1, GL_FLOAT);
break; break;
default: default:
init_array(ctx, obj, i, 4, GL_FLOAT); init_array(ctx, vao, i, 4, GL_FLOAT);
break; break;
} }
} }
_mesa_reference_buffer_object(ctx, &obj->IndexBufferObj, _mesa_reference_buffer_object(ctx, &vao->IndexBufferObj,
ctx->Shared->NullBufferObj); ctx->Shared->NullBufferObj);
} }
@ -309,11 +316,11 @@ _mesa_initialize_vao(struct gl_context *ctx,
* Add the given array object to the array object pool. * Add the given array object to the array object pool.
*/ */
static void static void
save_array_object( struct gl_context *ctx, struct gl_vertex_array_object *obj ) save_array_object(struct gl_context *ctx, struct gl_vertex_array_object *vao)
{ {
if (obj->Name > 0) { if (vao->Name > 0) {
/* insert into hash table */ /* insert into hash table */
_mesa_HashInsert(ctx->Array.Objects, obj->Name, obj); _mesa_HashInsert(ctx->Array.Objects, vao->Name, vao);
} }
} }
@ -323,11 +330,11 @@ save_array_object( struct gl_context *ctx, struct gl_vertex_array_object *obj )
* Do not deallocate the array object though. * Do not deallocate the array object though.
*/ */
static void static void
remove_array_object( struct gl_context *ctx, struct gl_vertex_array_object *obj ) remove_array_object(struct gl_context *ctx, struct gl_vertex_array_object *vao)
{ {
if (obj->Name > 0) { if (vao->Name > 0) {
/* remove from hash table */ /* remove from hash table */
_mesa_HashRemove(ctx->Array.Objects, obj->Name); _mesa_HashRemove(ctx->Array.Objects, vao->Name);
} }
} }