[Mesa-dev] [PATCH] mesa: simplify and optimise vertex bindings tracking

Juan A. Suarez Romero jasuarez at igalia.com
Fri Apr 7 10:04:36 UTC 2017


Reviewed-by: Juan A. Suarez Romero <jasuarez at igalia.com>


On Thu, 2017-04-06 at 14:47 +1000, Timothy Arceri wrote:
> We only need to update it if something changes. Also
> _mesa_bind_vertex_buffer() will update the mask when binding to a
> NULL or default buffer so no need to do that update here.
> ---
>  src/mesa/main/varray.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index a3836a1..fbaceb2 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -130,28 +130,26 @@ type_to_bit(const struct gl_context *ctx, GLenum type)
>   * attribIndex.
>   */
>  static void
>  vertex_attrib_binding(struct gl_context *ctx,
>                        struct gl_vertex_array_object *vao,
>                        GLuint attribIndex,
>                        GLuint bindingIndex)
>  {
>     struct gl_array_attributes *array = &vao->VertexAttrib[attribIndex];
>  
> -   if (!_mesa_is_bufferobj(vao->BufferBinding[bindingIndex].BufferObj))
> -      vao->VertexAttribBufferMask &= ~VERT_BIT(attribIndex);
> -   else
> -      vao->VertexAttribBufferMask |= VERT_BIT(attribIndex);
> -
>     if (array->BufferBindingIndex != bindingIndex) {
>        const GLbitfield64 array_bit = VERT_BIT(attribIndex);
>  
> +      if (_mesa_is_bufferobj(vao->BufferBinding[bindingIndex].BufferObj))
> +         vao->VertexAttribBufferMask |= array_bit;
> +
>        FLUSH_VERTICES(ctx, _NEW_ARRAY);
>  
>        vao->BufferBinding[array->BufferBindingIndex]._BoundArrays &= ~array_bit;
>        vao->BufferBinding[bindingIndex]._BoundArrays |= array_bit;
>  
>        array->BufferBindingIndex = bindingIndex;
>  
>        vao->NewArrays |= array_bit;
>     }
>  }


More information about the mesa-dev mailing list