i915: Fix NPOT compressed textures on 915.
authorEric Anholt <eric@anholt.net>
Mon, 11 Jul 2011 23:50:06 +0000 (16:50 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 12 Jul 2011 21:41:04 +0000 (14:41 -0700)
We were failing at rounding, misplacing the non-baselevels.  Fixes:
3DFX_texture_compression_FXT1/fbo-generate-mipmaps
ARB_texture_compression/fbo-generate-mipmaps
EXT_texture_compression_s3tc/fbo-generate-mipmaps

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i915/i915_tex_layout.c

index 6e4512129cd1c87628ec7a13a1dfc15cc91c9671..e6a471162239a4ac21676b8c9c27743b6c21c561 100644 (file)
@@ -219,9 +219,9 @@ i915_miptree_layout_2d(struct intel_context *intel,
                                   width, height, 1);
 
       if (mt->compressed)
-        img_height = MAX2(1, height / 4);
+        img_height = ALIGN(height, 4) / 4;
       else
-        img_height = (MAX2(2, height) + 1) & ~1;
+        img_height = ALIGN(height, 2);
 
       mt->total_height += img_height;