summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texstate.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2014-04-25 15:57:21 -0700
committerEric Anholt <eric@anholt.net>2014-04-30 14:33:21 -0700
commit973345fc2389e7f74b8732052e781672c4e135c2 (patch)
treeb5b8924ae645de38976aed40da84e2b7684ea84b /src/mesa/main/texstate.c
parent6a97deb88aa715af9760cf3c7ca0c1ff76e4f325 (diff)
downloadexternal_mesa3d-973345fc2389e7f74b8732052e781672c4e135c2.zip
external_mesa3d-973345fc2389e7f74b8732052e781672c4e135c2.tar.gz
external_mesa3d-973345fc2389e7f74b8732052e781672c4e135c2.tar.bz2
mesa: Track maximum CurrentTexUnit to reduce glDeleteTextures() overhead.
No more walking 96*6 pointers looking to see if they're the current texture, when we only use the first 2 out of 96 units. -6.26002% +/- 1.87817% effect on cairo runtime on no-fbo-cache glamor (n=36). Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Diffstat (limited to 'src/mesa/main/texstate.c')
-rw-r--r--src/mesa/main/texstate.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 3a7e227..000af94 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -108,6 +108,10 @@ _mesa_copy_texture_state( const struct gl_context *src, struct gl_context *dst )
for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
_mesa_reference_texobj(&dst->Texture.Unit[u].CurrentTex[tex],
src->Texture.Unit[u].CurrentTex[tex]);
+ if (src->Texture.Unit[u].CurrentTex[tex]) {
+ dst->Texture.NumCurrentTexUsed =
+ MAX2(dst->Texture.NumCurrentTexUsed, u + 1);
+ }
}
_mesa_unlock_context_textures(dst);
}
@@ -912,6 +916,8 @@ _mesa_init_texture(struct gl_context *ctx)
_mesa_reference_buffer_object(ctx, &ctx->Texture.BufferObject,
ctx->Shared->NullBufferObj);
+ ctx->Texture.NumCurrentTexUsed = 0;
+
return GL_TRUE;
}