diff options
author | Topi Pohjolainen <[email protected]> | 2017-05-01 08:43:19 +0300 |
---|---|---|
committer | Topi Pohjolainen <[email protected]> | 2017-06-19 22:41:45 +0300 |
commit | 71ac909137d9d61d3aa3ec3dbaaba69128e0d558 (patch) | |
tree | b9ade86b68a8c3e98a3eff961fd75de03b7e0fff /src/mesa/drivers | |
parent | de158c1e435eb9160b8a29624a4a4807e1627811 (diff) |
i965: Prepare slice copy for isl based miptrees
v2 (Jason): Fix a helper variable only used for assert -
open code instead.
Reviewed-by: Nanley Chery <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Signed-off-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index f0d304c3710..b50c30e6769 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -1318,7 +1318,8 @@ intel_miptree_copy_slice_sw(struct brw_context *brw, { void *src, *dst; ptrdiff_t src_stride, dst_stride; - int cpp = dst_mt->cpp; + const unsigned cpp = dst_mt->surf.size > 0 ? + (isl_format_get_layout(dst_mt->surf.format)->bpb / 8) : dst_mt->cpp; intel_miptree_map(brw, src_mt, src_level, src_layer, @@ -1379,13 +1380,28 @@ intel_miptree_copy_slice(struct brw_context *brw, unsigned dst_level, unsigned dst_layer) { - uint32_t width = minify(src_mt->physical_width0, - src_level - src_mt->first_level); - uint32_t height = minify(src_mt->physical_height0, - src_level - src_mt->first_level); mesa_format format = src_mt->format; + uint32_t width, height; + + if (src_mt->surf.size > 0) { + width = minify(src_mt->surf.phys_level0_sa.width, + src_level - src_mt->first_level); + height = minify(src_mt->surf.phys_level0_sa.height, + src_level - src_mt->first_level); + + if (src_mt->surf.dim == ISL_SURF_DIM_3D) + assert(src_layer < minify(src_mt->surf.phys_level0_sa.depth, + src_level - src_mt->first_level)); + else + assert(src_layer < src_mt->surf.phys_level0_sa.array_len); + } else { + width = minify(src_mt->physical_width0, + src_level - src_mt->first_level); + height = minify(src_mt->physical_height0, + src_level - src_mt->first_level); + assert(src_layer < src_mt->level[src_level].depth); + } - assert(src_layer < src_mt->level[src_level].depth); assert(src_mt->format == dst_mt->format); if (dst_mt->compressed) { |