[intel] fix random ut2004 crash on some machine, for cubemap textures,
authorZou Nan hai <nanhai.zou@intel.com>
Mon, 25 Feb 2008 07:27:47 +0000 (15:27 +0800)
committerZou Nan hai <nanhai.zou@intel.com>
Mon, 25 Feb 2008 07:27:47 +0000 (15:27 +0800)
image offset is already considered when map, add it again in
        StoreImage may lead to wrong result and crash.

src/mesa/drivers/dri/intel/intel_mipmap_tree.c

index d446b2b392ab10feed2ed0fdf92624600f071334..941f7a697c3407c3fc58516e848a7e8913117e3e 100644 (file)
@@ -375,9 +375,13 @@ intel_miptree_image_map(struct intel_context * intel,
    if (row_stride)
       *row_stride = mt->pitch * mt->cpp;
 
-   if (image_offsets)
-      memcpy(image_offsets, mt->level[level].image_offset,
-             mt->level[level].depth * sizeof(GLuint));
+   if (image_offsets) {
+      if (mt->target == GL_TEXTURE_CUBE_MAP_ARB)
+                  memset(image_offsets, 0, mt->level[level].depth * sizeof(GLuint));
+         else
+                  memcpy(image_offsets, mt->level[level].image_offset,
+                          mt->level[level].depth * sizeof(GLuint));
+   }
 
    return (intel_region_map(intel, mt->region) +
            intel_miptree_image_offset(mt, face, level));