--- src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index 9fdd56eaf2..a2d4fa9d92 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -2986,15 +2986,23 @@ intel_miptree_map_movntdqa(struct brw_context *brw, src += mt->offset; - src += image_y * mt->pitch; - src += image_x * mt->cpp; + if (mt->surf.size > 0) { + src += image_y * mt->surf.row_pitch; + src += image_x * isl_format_get_layout(mt->surf.format)->bpb / 8; + } else { + src += image_y * mt->pitch; + src += image_x * mt->cpp; + } /* Due to the pixel offsets for the particular image being mapped, our * src pointer may not be 16-byte aligned. However, if the pitch is * divisible by 16, then the amount by which it's misaligned will remain * consistent from row to row. */ - assert((mt->pitch % 16) == 0); + if (mt->surf.size > 0) + assert((mt->surf.row_pitch % 16) == 0); + else + assert((mt->pitch % 16) == 0); const int misalignment = ((uintptr_t) src) & 15; /* Create an untiled temporary buffer for the mapping. */ @@ -3008,9 +3016,10 @@ intel_miptree_map_movntdqa(struct brw_context *brw, assert((((uintptr_t) map->ptr) & 15) == misalignment); + const unsigned pitch = mt->surf.size > 0 ? mt->surf.row_pitch : mt->pitch; for (uint32_t y = 0; y < map->h; y++) { void *dst_ptr = map->ptr + y * map->stride; - void *src_ptr = src + y * mt->pitch; + void *src_ptr = src + y * pitch; _mesa_streaming_load_memcpy(dst_ptr, src_ptr, width_bytes); } -- 2.11.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev