fix miptree layout (i915) for small compressed mipmaps
authorRoland Scheidegger <sroland@tungstengraphics.com>
Sat, 19 May 2007 02:38:55 +0000 (04:38 +0200)
committerRoland Scheidegger <sroland@tungstengraphics.com>
Sat, 19 May 2007 02:38:55 +0000 (04:38 +0200)
This seems to work now. Also fix i945 set_level_info, need to match i915
behaviour for storing mip height, as it's assumed to be the mip width
(in texels) elsewhere and the division by 4 is done later (untested).

src/mesa/drivers/dri/i915tex/i915_tex_layout.c
src/mesa/drivers/dri/intel/intel_tex_layout.c

index 2e1600cfdfa0b96e3b128b76a7bda9c3489d32d0..9f40706c36a8ddbecdc3d76b5e1cd407c76e4f7d 100644 (file)
@@ -161,11 +161,9 @@ i915_miptree_layout(struct intel_mipmap_tree * mt)
             if (mt->compressed)
                img_height = MAX2(1, height / 4);
             else
-               img_height = MAX2(2, height);
+               img_height = (MAX2(2, height) + 1) & ~1;
 
            mt->total_height += img_height;
-           mt->total_height += 1;
-           mt->total_height &= ~1;
 
             width = minify(width);
             height = minify(height);
index f35648021713b36f3b18b433b2336417c52645a4..fcb5cc390682587c36db93ff630d339b71269e30 100644 (file)
@@ -74,7 +74,7 @@ void i945_miptree_layout_2d( struct intel_mipmap_tree *mt )
       GLuint img_height;
 
       intel_miptree_set_level_info(mt, level, 1, x, y, width, 
-                                  mt->compressed ? height/4 : height, 1);
+                                  height, 1);
 
       if (mt->compressed)
         img_height = MAX2(1, height/4);