diff options
author | Brian Paul <brianp@vmware.com> | 2016-10-06 17:16:51 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2016-10-13 17:38:49 -0600 |
commit | c328268b9292664bd5de73ee39ed8b91ccfb38d1 (patch) | |
tree | 69646a0ae52eed6ccafd849789f116445c190e1a | |
parent | b81546d43c4ae670babfc496f7d5cce1c1a22399 (diff) |
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>
-rw-r--r-- | src/mesa/main/arrayobj.c | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 2d3b69cd8de..fe11686c1fb 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -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 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_buffer_binding *binding = &obj->VertexBinding[index]; + struct gl_vertex_attrib_array *array = &vao->VertexAttrib[index]; + struct gl_vertex_buffer_binding *binding = &vao->VertexBinding[index]; array->Size = size; array->Type = type; @@ -260,47 +267,47 @@ init_array(struct gl_context *ctx, */ void _mesa_initialize_vao(struct gl_context *ctx, - struct gl_vertex_array_object *obj, + struct gl_vertex_array_object *vao, GLuint name) { GLuint i; - obj->Name = name; + vao->Name = name; - mtx_init(&obj->Mutex, mtx_plain); - obj->RefCount = 1; + mtx_init(&vao->Mutex, mtx_plain); + vao->RefCount = 1; /* Init the individual arrays */ - for (i = 0; i < ARRAY_SIZE(obj->VertexAttrib); i++) { + for (i = 0; i < ARRAY_SIZE(vao->VertexAttrib); i++) { switch (i) { 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; 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; 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; 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; 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; 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; 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; default: - init_array(ctx, obj, i, 4, GL_FLOAT); + init_array(ctx, vao, i, 4, GL_FLOAT); break; } } - _mesa_reference_buffer_object(ctx, &obj->IndexBufferObj, + _mesa_reference_buffer_object(ctx, &vao->IndexBufferObj, ctx->Shared->NullBufferObj); } @@ -309,11 +316,11 @@ _mesa_initialize_vao(struct gl_context *ctx, * Add the given array object to the array object pool. */ 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 */ - _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. */ 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 */ - _mesa_HashRemove(ctx->Array.Objects, obj->Name); + _mesa_HashRemove(ctx->Array.Objects, vao->Name); } } |