Bug #13839: Fix 3D texture offset miscalculation with pixels versus bytes.
authorRoland Scheidegger <sroland@tungstengraphics.com>
Sat, 29 Dec 2007 02:03:39 +0000 (18:03 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 29 Dec 2007 02:05:22 +0000 (18:05 -0800)
src/mesa/drivers/dri/intel/intel_mipmap_tree.c
src/mesa/drivers/dri/intel/intel_mipmap_tree.h

index 763758503310200924cb79b78b91f8126c18206c..97a82fe9d0f3be86d57eaad07ea51502ac8cfa9f 100644 (file)
@@ -358,7 +358,7 @@ intel_miptree_image_data(struct intel_context *intel,
         height /= 4;
       intel_region_data(intel,
                        dst->region,
-                       dst_offset + dst_depth_offset[i], /* dst_offset */
+                       dst_offset + dst_depth_offset[i] * dst->cpp, /* dst_offset */
                        0, 0,                             /* dstx, dsty */
                        src,
                        src_row_pitch,
@@ -395,10 +395,10 @@ intel_miptree_image_copy(struct intel_context *intel,
 
    for (i = 0; i < depth; i++) {
       intel_region_copy(intel,
-                        dst->region, dst_offset + dst_depth_offset[i],
+                        dst->region, dst_offset + dst_depth_offset[i] * dst->cpp,
                         0,
                         0,
-                        src->region, src_offset + src_depth_offset[i],
+                        src->region, src_offset + src_depth_offset[i] * src->cpp,
                         0, 0, width, height);
    }
 
index 968eec4fec3280032e69889452ff95b4cab76a77..e3b31f9c6e5f0c0d63a9b05e2a137283f7a7583e 100644 (file)
@@ -73,6 +73,7 @@ struct intel_mipmap_level
     * are going to be so diverse that there is no unified way to
     * compute the offsets of depth/cube images within a mipmap level,
     * so have to store them as a lookup table:
+    * NOTE level_offset is a byte offset, but the image_offsets are _pixel_ offsets!!!
     */
    GLuint *image_offset;
 };