summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-08-24 15:53:34 +0200
committerSamuel Pitoiset <[email protected]>2017-08-25 11:11:54 +0200
commit5946806064db29f6bf13a44307326be4d1a0f3f4 (patch)
tree2512b2e649e6ff2f8a09c795657bdcc5c1a438bf /src/mesa/main
parent08ee28b6a86ff85eb1d4ac4b72be2aaf07f83729 (diff)
mesa: port the LastLookedUpVAO optimisation to _mesa_lookup_vao()
It was only used in the errors path. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/arrayobj.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c
index 600177cc5c9..88a5702f412 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;
+ }
}