mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 00:49:04 +02:00
mesa: port the LastLookedUpVAO optimisation to _mesa_lookup_vao()
It was only used in the errors path. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
parent
08ee28b6a8
commit
5946806064
1 changed files with 16 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue