[Mesa-dev] [PATCH] mesa: port the LastLookedUpVAO optimisation to _mesa_lookup_vao()

Timothy Arceri tarceri at itsqueeze.com
Fri Aug 25 00:18:30 UTC 2017


Thanks for fixing this I'd been meaning to look into it.

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

On 24/08/17 23:53, Samuel Pitoiset wrote:
> It was only used in the errors path.
> 
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>   src/mesa/main/arrayobj.c | 20 ++++++++++++++++----
>   1 file changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
> index 600177cc5c..88a5702f41 100644
> --- a/src/mesa/main/arrayobj.c
> +++ b/src/mesa/main/arrayobj.c
> @@ -66,11 +66,23 @@
>   struct gl_vertex_array_object *
>   _mesa_lookup_vao(struct gl_context *ctx, GLuint id)
>   {
> -   if (id == 0)
> +   if (id == 0) {
>         return NULL;
> -   else
> -      return (struct gl_vertex_array_object *)
> -         _mesa_HashLookupLocked(ctx->Array.Objects, id);
> +   } else {
> +      struct gl_vertex_array_object *vao;
> +
> +      if (ctx->Array.LastLookedUpVAO &&
> +          ctx->Array.LastLookedUpVAO->Name == id) {
> +         vao = ctx->Array.LastLookedUpVAO;
> +      } else {
> +         vao = (struct gl_vertex_array_object *)
> +            _mesa_HashLookupLocked(ctx->Array.Objects, id);
> +
> +         _mesa_reference_vao(ctx, &ctx->Array.LastLookedUpVAO, vao);
> +      }
> +
> +      return vao;
> +   }
>   }
>   
>   
> 


More information about the mesa-dev mailing list