diff options
author | Eric Anholt <[email protected]> | 2014-04-25 15:57:21 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2014-04-30 14:33:21 -0700 |
commit | 973345fc2389e7f74b8732052e781672c4e135c2 (patch) | |
tree | b5b8924ae645de38976aed40da84e2b7684ea84b /src/mesa/main/texobj.c | |
parent | 6a97deb88aa715af9760cf3c7ca0c1ff76e4f325 (diff) |
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 <[email protected]>
Diffstat (limited to 'src/mesa/main/texobj.c')
-rw-r--r-- | src/mesa/main/texobj.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 918dd59edaa..85246c8ab00 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1094,7 +1094,7 @@ unbind_texobj_from_texunits(struct gl_context *ctx, { GLuint u, tex; - for (u = 0; u < Elements(ctx->Texture.Unit); u++) { + for (u = 0; u < ctx->Texture.NumCurrentTexUsed; u++) { struct gl_texture_unit *unit = &ctx->Texture.Unit[u]; for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { if (texObj == unit->CurrentTex[tex]) { @@ -1353,6 +1353,8 @@ _mesa_BindTexture( GLenum target, GLuint texName ) * count hits zero. */ _mesa_reference_texobj(&texUnit->CurrentTex[targetIndex], newTexObj); + ctx->Texture.NumCurrentTexUsed = MAX2(ctx->Texture.NumCurrentTexUsed, + ctx->Texture.CurrentUnit + 1); ASSERT(texUnit->CurrentTex[targetIndex]); /* Pass BindTexture call to device driver */ |