diff options
author | Corbin Simpson <[email protected]> | 2009-08-07 20:16:39 -0700 |
---|---|---|
committer | Corbin Simpson <[email protected]> | 2009-08-07 20:50:42 -0700 |
commit | 847fcb645c1d0c69617f0cafe8e6410e13f08fa6 (patch) | |
tree | 525a20ed0f38dbc22c9179eefcadad826af268b1 | |
parent | c58133b81ab7c9ee12cac05c4671a87e34708a66 (diff) |
gallium: Move minify() to u_math.
minify() is usually used in mipmap size calculation. Strangely enough,
we all defined it as MAX2(1, d >> 1); imagine that. :3
-rw-r--r-- | src/gallium/auxiliary/util/u_math.h | 5 | ||||
-rw-r--r-- | src/gallium/drivers/cell/ppu/cell_texture.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/i915simple/i915_texture.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/i965simple/brw_tex_layout.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_texture.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_texture.c | 5 |
6 files changed, 5 insertions, 29 deletions
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 167fc83dc1d..57410e78b02 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -450,6 +450,11 @@ align(int value, int alignment) return (value + alignment - 1) & ~(alignment - 1); } +static INLINE unsigned +minify(unsigned value) +{ + return MAX2(1, value >> 1); +} #ifndef COPY_4V #define COPY_4V( DST, SRC ) \ diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c index e26594448f0..80418f5aa21 100644 --- a/src/gallium/drivers/cell/ppu/cell_texture.c +++ b/src/gallium/drivers/cell/ppu/cell_texture.c @@ -44,13 +44,6 @@ -static unsigned -minify(unsigned d) -{ - return MAX2(1, d>>1); -} - - static void cell_texture_layout(struct cell_texture *ct) { diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c index ac38bb50ac6..03f0e14e7c8 100644 --- a/src/gallium/drivers/i915simple/i915_texture.c +++ b/src/gallium/drivers/i915simple/i915_texture.c @@ -72,11 +72,6 @@ static const int step_offsets[6][2] = { {-1, 1} }; -static unsigned minify( unsigned d ) -{ - return MAX2(1, d>>1); -} - static unsigned power_of_two(unsigned x) { diff --git a/src/gallium/drivers/i965simple/brw_tex_layout.c b/src/gallium/drivers/i965simple/brw_tex_layout.c index 8aea8c05581..998ffaeac4a 100644 --- a/src/gallium/drivers/i965simple/brw_tex_layout.c +++ b/src/gallium/drivers/i965simple/brw_tex_layout.c @@ -65,11 +65,6 @@ unsigned intel_compressed_alignment(unsigned internalFormat) } #endif -static unsigned minify( unsigned d ) -{ - return MAX2(1, d>>1); -} - static void intel_miptree_set_image_offset(struct brw_texture *tex, unsigned level, diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 0164f050961..590052509cc 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -22,13 +22,6 @@ #include "r300_texture.h" -/* XXX maths need to go to util */ - -static int minify(int i) -{ - return MAX2(1, i >> 1); -} - static void r300_setup_texture_state(struct r300_texture* tex, unsigned width, unsigned height, diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 4af520e3fd2..b7e52af0322 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -48,11 +48,6 @@ /* Simple, maximally packed layout. */ -static unsigned minify( unsigned d ) -{ - return MAX2(1, d>>1); -} - /* Conventional allocation path for non-display textures: */ |