Mesa (master): intel: Avoid taking logbase2 of several things that we max.
Eric Anholt
anholt at kemper.freedesktop.org
Wed Nov 3 13:08:56 UTC 2010
Module: Mesa
Branch: master
Commit: 0300c9ab54f80bb7f172672c8e748721c658f660
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0300c9ab54f80bb7f172672c8e748721c658f660
Author: Eric Anholt <eric at anholt.net>
Date: Tue Nov 2 20:30:41 2010 -0700
intel: Avoid taking logbase2 of several things that we max.
logbase2(max(width, height, depth)) ==
max(logbase2(width), logbase2(height), logbase2(depth)), but in 60
bytes less code.
---
src/mesa/drivers/dri/intel/intel_tex_image.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 35f3d7d..05d72ba 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -66,7 +66,6 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel,
GLuint width = intelImage->base.Width;
GLuint height = intelImage->base.Height;
GLuint depth = intelImage->base.Depth;
- GLuint l2width, l2height, l2depth;
GLuint i, comp_byte = 0;
GLuint texelBytes;
@@ -114,10 +113,7 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel,
lastLevel = firstLevel;
}
else {
- l2width = logbase2(width);
- l2height = logbase2(height);
- l2depth = logbase2(depth);
- lastLevel = firstLevel + MAX2(MAX2(l2width, l2height), l2depth);
+ lastLevel = firstLevel + logbase2(MAX2(MAX2(width, height), depth));
}
assert(!intelObj->mt);
More information about the mesa-commit
mailing list