summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 556a82fc7ff..cd7299e2a30 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -1292,9 +1292,10 @@ intel_miptree_map_etc1(struct intel_context *intel,
assert(map->x == 0);
assert(map->y == 0);
- /* Each ETC1 block contains 4x4 pixels in 8 bytes. */
- map->stride = 2 * map->w;
- map->buffer = map->ptr = malloc(map->stride * map->h);
+ map->stride = _mesa_format_row_stride(MESA_FORMAT_ETC1_RGB8, map->w);
+ map->buffer = malloc(_mesa_format_image_size(MESA_FORMAT_ETC1_RGB8,
+ map->w, map->h, 1));
+ map->ptr = map->buffer;
}
static void