[Mesa-dev] [PATCH 3/5] corresponding cleanup for patch 11: Optimize rebinding the same VBO

Fredrik Höglund fredrik at kde.org
Fri Nov 1 11:58:49 PDT 2013


I spotted a small bug in this patch.

On Thursday 31 October 2013, Eric Anholt wrote:
> ---
>  src/mesa/main/varray.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c
> index e7ff8d7..0087096 100644
> --- a/src/mesa/main/varray.c
> +++ b/src/mesa/main/varray.c
> @@ -1347,10 +1347,10 @@ void GLAPIENTRY
>  _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset,
>                         GLsizei stride)
>  {
> +   GET_CURRENT_CONTEXT(ctx);
> +   const struct gl_array_object *arrayObj = ctx->Array.ArrayObj;
>     struct gl_buffer_object *vbo;
> -   struct gl_vertex_buffer_binding *binding;
>  
> -   GET_CURRENT_CONTEXT(ctx);
>     ASSERT_OUTSIDE_BEGIN_END(ctx);
>  
>     /* The ARB_vertex_attrib_binding spec says:
> @@ -1395,10 +1395,8 @@ _mesa_BindVertexBuffer(GLuint bindingIndex, GLuint buffer, GLintptr offset,
>        return;
>     }
>  
> -   binding = gl_vertex_buffer_binding(ctx, VERT_ATTRIB_GENERIC(bindingIndex));
> -
> -   if (buffer == binding->BufferObj->Name) {
> -      vbo = binding->BufferObj;
> +   if (buffer == arrayObj->VertexBinding[bindingIndex].BufferObj->Name) {
> +      vbo = arrayObj->VertexBinding[bindingIndex].BufferObj;

This should be VertexBinding[VERT_ATTRIB_GENERIC(bindingIndex)].

>     } else if (buffer != 0) {
>        vbo = _mesa_lookup_bufferobj(ctx, buffer);

I squashed the patch with the above change.

Fredrik



More information about the mesa-dev mailing list