On Tuesday, 11 October 2016 20:10:27 CEST Brian Paul wrote:
> Rename to gl_vertex_attrib_array::BufferBindingIndex because this field
> is an index into the array of buffer binding points.  This makes some
> code a little easier to follow since there's also a "VertexBinding" field
> in gl_vertex_array_object.

What about BindingIndex instead?
Either way is ok with me, but may be this helps not to get too long lines 
including the benefits you are aiming for?

Mathias


> ---
>  src/mesa/main/api_arrayelt.c  | 20 ++++++++++----------
>  src/mesa/main/arrayobj.c      |  8 ++++----
>  src/mesa/main/mtypes.h        |  2 +-
>  src/mesa/main/varray.c        | 16 ++++++++--------
>  src/mesa/vbo/vbo_exec_array.c |  6 +++---
>  5 files changed, 26 insertions(+), 26 deletions(-)
> 
> diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c
> index 15fbb8c..cc7dee3 100644
> --- a/src/mesa/main/api_arrayelt.c
> +++ b/src/mesa/main/api_arrayelt.c
> @@ -1566,7 +1566,7 @@ _ae_update_state(struct gl_context *ctx)
>     /* conventional vertex arrays */
>     if (vao->VertexAttrib[VERT_ATTRIB_COLOR_INDEX].Enabled) {
>        aa->array = &vao->VertexAttrib[VERT_ATTRIB_COLOR_INDEX];
> -      aa->binding = &vao->VertexBinding[aa->array->VertexBinding];
> +      aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
>        aa->offset = IndexFuncs[TYPE_IDX(aa->array->Type)];
>        check_vbo(actx, aa->binding->BufferObj);
>        aa++;
> @@ -1574,7 +1574,7 @@ _ae_update_state(struct gl_context *ctx)
>  
>     if (vao->VertexAttrib[VERT_ATTRIB_EDGEFLAG].Enabled) {
>        aa->array = &vao->VertexAttrib[VERT_ATTRIB_EDGEFLAG];
> -      aa->binding = &vao->VertexBinding[aa->array->VertexBinding];
> +      aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
>        aa->offset = _gloffset_EdgeFlagv;
>        check_vbo(actx, aa->binding->BufferObj);
>        aa++;
> @@ -1582,7 +1582,7 @@ _ae_update_state(struct gl_context *ctx)
>  
>     if (vao->VertexAttrib[VERT_ATTRIB_NORMAL].Enabled) {
>        aa->array = &vao->VertexAttrib[VERT_ATTRIB_NORMAL];
> -      aa->binding = &vao->VertexBinding[aa->array->VertexBinding];
> +      aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
>        aa->offset = NormalFuncs[TYPE_IDX(aa->array->Type)];
>        check_vbo(actx, aa->binding->BufferObj);
>        aa++;
> @@ -1590,7 +1590,7 @@ _ae_update_state(struct gl_context *ctx)
>  
>     if (vao->VertexAttrib[VERT_ATTRIB_COLOR0].Enabled) {
>        aa->array = &vao->VertexAttrib[VERT_ATTRIB_COLOR0];
> -      aa->binding = &vao->VertexBinding[aa->array->VertexBinding];
> +      aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
>        aa->offset = ColorFuncs[aa->array->Size-3][TYPE_IDX(aa->array-
>Type)];
>        check_vbo(actx, aa->binding->BufferObj);
>        aa++;
> @@ -1598,7 +1598,7 @@ _ae_update_state(struct gl_context *ctx)
>  
>     if (vao->VertexAttrib[VERT_ATTRIB_COLOR1].Enabled) {
>        aa->array = &vao->VertexAttrib[VERT_ATTRIB_COLOR1];
> -      aa->binding = &vao->VertexBinding[aa->array->VertexBinding];
> +      aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
>        aa->offset = SecondaryColorFuncs[TYPE_IDX(aa->array->Type)];
>        check_vbo(actx, aa->binding->BufferObj);
>        aa++;
> @@ -1606,7 +1606,7 @@ _ae_update_state(struct gl_context *ctx)
>  
>     if (vao->VertexAttrib[VERT_ATTRIB_FOG].Enabled) {
>        aa->array = &vao->VertexAttrib[VERT_ATTRIB_FOG];
> -      aa->binding = &vao->VertexBinding[aa->array->VertexBinding];
> +      aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
>        aa->offset = FogCoordFuncs[TYPE_IDX(aa->array->Type)];
>        check_vbo(actx, aa->binding->BufferObj);
>        aa++;
> @@ -1620,7 +1620,7 @@ _ae_update_state(struct gl_context *ctx)
>            * If we ever remove GL_NV_vertex_program this will have to 
change.
>            */
>           at->array = attribArray;
> -         at->binding = &vao->VertexBinding[attribArray->VertexBinding];
> +         at->binding = &vao->VertexBinding[attribArray-
>BufferBindingIndex];
>           assert(!at->array->Normalized);
>           at->func = AttribFuncsNV[at->array->Normalized]
>                                   [at->array->Size-1]
> @@ -1638,7 +1638,7 @@ _ae_update_state(struct gl_context *ctx)
>        if (attribArray->Enabled) {
>           GLint intOrNorm;
>           at->array = attribArray;
> -         at->binding = &vao->VertexBinding[attribArray->VertexBinding];
> +         at->binding = &vao->VertexBinding[attribArray-
>BufferBindingIndex];
>           /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV
>            * function pointer here (for float arrays) since the pointer may
>            * change from one execution of _ae_ArrayElement() to
> @@ -1669,7 +1669,7 @@ _ae_update_state(struct gl_context *ctx)
>         * issued as the last (provoking) attribute).
>         */
>        aa->array = &vao->VertexAttrib[VERT_ATTRIB_GENERIC0];
> -      aa->binding = &vao->VertexBinding[aa->array->VertexBinding];
> +      aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
>        assert(aa->array->Size >= 2); /* XXX fix someday? */
>        aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array-
>Type)];
>        check_vbo(actx, aa->binding->BufferObj);
> @@ -1677,7 +1677,7 @@ _ae_update_state(struct gl_context *ctx)
>     }
>     else if (vao->VertexAttrib[VERT_ATTRIB_POS].Enabled) {
>        aa->array = &vao->VertexAttrib[VERT_ATTRIB_POS];
> -      aa->binding = &vao->VertexBinding[aa->array->VertexBinding];
> +      aa->binding = &vao->VertexBinding[aa->array->BufferBindingIndex];
>        aa->offset = VertexFuncs[aa->array->Size-2][TYPE_IDX(aa->array-
>Type)];
>        check_vbo(actx, aa->binding->BufferObj);
>        aa++;
> diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
> index fe11686..8258964 100644
> --- a/src/mesa/main/arrayobj.c
> +++ b/src/mesa/main/arrayobj.c
> @@ -249,7 +249,7 @@ init_array(struct gl_context *ctx,
>     array->Integer = GL_FALSE;
>     array->Doubles = GL_FALSE;
>     array->_ElementSize = size * _mesa_sizeof_type(type);
> -   array->VertexBinding = index;
> +   array->BufferBindingIndex = index;
>  
>     binding->Offset = 0;
>     binding->Stride = array->_ElementSize;
> @@ -357,7 +357,7 @@ _mesa_update_vao_client_arrays(struct gl_context *ctx,
>        struct gl_vertex_buffer_binding *buffer_binding;
>  
>        attrib_array = &vao->VertexAttrib[attrib];
> -      buffer_binding = &vao->VertexBinding[attrib_array->VertexBinding];
> +      buffer_binding = &vao->VertexBinding[attrib_array-
>BufferBindingIndex];
>        client_array = &vao->_VertexAttrib[attrib];
>  
>        _mesa_update_client_array(ctx, client_array, attrib_array,
> @@ -380,7 +380,7 @@ _mesa_all_varyings_in_vbos(const struct 
gl_vertex_array_object *vao)
>        const struct gl_vertex_attrib_array *attrib_array =
>           &vao->VertexAttrib[i];
>        const struct gl_vertex_buffer_binding *buffer_binding =
> -         &vao->VertexBinding[attrib_array->VertexBinding];
> +         &vao->VertexBinding[attrib_array->BufferBindingIndex];
>  
>        /* Only enabled arrays shall appear in the _Enabled bitmask */
>        assert(attrib_array->Enabled);
> @@ -411,7 +411,7 @@ _mesa_all_buffers_are_unmapped(const struct 
gl_vertex_array_object *vao)
>        const struct gl_vertex_attrib_array *attrib_array =
>           &vao->VertexAttrib[i];
>        const struct gl_vertex_buffer_binding *buffer_binding =
> -         &vao->VertexBinding[attrib_array->VertexBinding];
> +         &vao->VertexBinding[attrib_array->BufferBindingIndex];
>  
>        /* Only enabled arrays shall appear in the _Enabled bitmask */
>        assert(attrib_array->Enabled);
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 61d6bf1..a639fd2 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -1376,7 +1376,7 @@ struct gl_vertex_attrib_array
>     GLboolean Integer;       /**< Fixed-point values are not converted to 
floats */
>     GLboolean Doubles;       /**< double precision values are not converted 
to floats */
>     GLuint _ElementSize;     /**< Size of each element in bytes */
> -   GLuint VertexBinding;    /**< Vertex buffer binding */
> +   GLuint BufferBindingIndex;    /**< Vertex buffer binding */
>  };
>  
>  
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index 027ae7c..a2f957a 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -140,15 +140,15 @@ vertex_attrib_binding(struct gl_context *ctx,
>     else
>       vao->VertexAttribBufferMask |= VERT_BIT(attribIndex);
>  
> -   if (array->VertexBinding != bindingIndex) {
> +   if (array->BufferBindingIndex != bindingIndex) {
>        const GLbitfield64 array_bit = VERT_BIT(attribIndex);
>  
>        FLUSH_VERTICES(ctx, _NEW_ARRAY);
>  
> -      vao->VertexBinding[array->VertexBinding]._BoundArrays &= ~array_bit;
> +      vao->VertexBinding[array->BufferBindingIndex]._BoundArrays &= 
~array_bit;
>        vao->VertexBinding[bindingIndex]._BoundArrays |= array_bit;
>  
> -      array->VertexBinding = bindingIndex;
> +      array->BufferBindingIndex = bindingIndex;
>  
>        vao->NewArrays |= array_bit;
>     }
> @@ -928,7 +928,7 @@ get_vertex_array_attrib(struct gl_context *ctx,
>     case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB:
>        return array->Normalized;
>     case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB:
> -      return vao->VertexBinding[array->VertexBinding].BufferObj->Name;
> +      return vao->VertexBinding[array->BufferBindingIndex].BufferObj->Name;
>     case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
>        if ((_mesa_is_desktop_gl(ctx)
>             && (ctx->Version >= 30 || ctx->Extensions.EXT_gpu_shader4))
> @@ -944,12 +944,12 @@ get_vertex_array_attrib(struct gl_context *ctx,
>     case GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB:
>        if ((_mesa_is_desktop_gl(ctx) && ctx-
>Extensions.ARB_instanced_arrays)
>            || _mesa_is_gles3(ctx)) {
> -         return vao->VertexBinding[array->VertexBinding].InstanceDivisor;
> +         return vao->VertexBinding[array-
>BufferBindingIndex].InstanceDivisor;
>        }
>        goto error;
>     case GL_VERTEX_ATTRIB_BINDING:
>        if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles31(ctx)) {
> -         return array->VertexBinding - VERT_ATTRIB_GENERIC0;
> +         return array->BufferBindingIndex - VERT_ATTRIB_GENERIC0;
>        }
>        goto error;
>     case GL_VERTEX_ATTRIB_RELATIVE_OFFSET:
> @@ -2333,7 +2333,7 @@ _mesa_copy_vertex_attrib_array(struct gl_context *ctx,
>     dst->Size           = src->Size;
>     dst->Type           = src->Type;
>     dst->Format         = src->Format;
> -   dst->VertexBinding  = src->VertexBinding;
> +   dst->BufferBindingIndex = src->BufferBindingIndex;
>     dst->RelativeOffset = src->RelativeOffset;
>     dst->Format         = src->Format;
>     dst->Integer        = src->Integer;
> @@ -2374,7 +2374,7 @@ _mesa_print_arrays(struct gl_context *ctx)
>           continue;
>  
>        const struct gl_vertex_buffer_binding *binding =
> -         &vao->VertexBinding[array->VertexBinding];
> +         &vao->VertexBinding[array->BufferBindingIndex];
>        const struct gl_buffer_object *bo = binding->BufferObj;
>  
>        fprintf(stderr, "  %s: Ptr=%p, Type=%s, Size=%d, ElemSize=%u, "
> diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
> index 46543f8..b5ed210 100644
> --- a/src/mesa/vbo/vbo_exec_array.c
> +++ b/src/mesa/vbo/vbo_exec_array.c
> @@ -54,7 +54,7 @@ check_array_data(struct gl_context *ctx, struct 
gl_vertex_array_object *vao,
>     const struct gl_vertex_attrib_array *array = &vao->VertexAttrib[attrib];
>     if (array->Enabled) {
>        const struct gl_vertex_buffer_binding *binding =
> -         &vao->VertexBinding[array->VertexBinding];
> +         &vao->VertexBinding[array->BufferBindingIndex];
>        struct gl_buffer_object *bo = binding->BufferObj;
>        const void *data = array->Ptr;
>        if (_mesa_is_bufferobj(bo)) {
> @@ -106,7 +106,7 @@ unmap_array_buffer(struct gl_context *ctx, struct 
gl_vertex_array_object *vao,
>     const struct gl_vertex_attrib_array *array = &vao->VertexAttrib[attrib];
>     if (array->Enabled) {
>        const struct gl_vertex_buffer_binding *binding =
> -         &vao->VertexBinding[array->VertexBinding];
> +         &vao->VertexBinding[array->BufferBindingIndex];
>        struct gl_buffer_object *bo = binding->BufferObj;
>        if (_mesa_is_bufferobj(bo) && _mesa_bufferobj_mapped(bo, 
MAP_INTERNAL)) {
>           ctx->Driver.UnmapBuffer(ctx, bo, MAP_INTERNAL);
> @@ -201,7 +201,7 @@ print_draw_arrays(struct gl_context *ctx,
>           continue;
>  
>        const struct gl_vertex_buffer_binding *binding =
> -         &vao->VertexBinding[array->VertexBinding];
> +         &vao->VertexBinding[array->BufferBindingIndex];
>        struct gl_buffer_object *bufObj = binding->BufferObj;
>  
>        printf("attr %s: size %d stride %d  enabled %d  "
> 


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to