[Mesa-dev] [PATCH 1/8] mesa: rename some vars in arrayobj.c

Mathias Fröhlich Mathias.Froehlich at gmx.net
Wed Oct 12 07:43:23 UTC 2016


Hi,

On Tuesday, 11 October 2016 20:10:26 CEST Brian Paul wrote:
> Use 'vao' instead of 'obj' to be consistent with other code.
> Plus, add a comment.

One question in patch #2.
Either way, the series is:

Reviewed-by: Mathias Fröhlich <mathias.froehlich at web.de>




> ---
>  src/mesa/main/arrayobj.c | 55 ++++++++++++++++++++++++++
+---------------------
>  1 file changed, 31 insertions(+), 24 deletions(-)
> 
> diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
> index 2d3b69c..fe11686 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);
>     }
>  }
>  
> 




More information about the mesa-dev mailing list