<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jun 13, 2017 at 7:50 AM, Topi Pohjolainen <span dir="ltr"><<a href="mailto:topi.pohjolainen@gmail.com" target="_blank">topi.pohjolainen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Signed-off-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
---<br>
src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c | 28 +++++++++++++++++++++------<br>
1 file changed, 22 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
index f44bac988f..c81d345fbc 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>intel_mipmap_tree.c<br>
@@ -1294,7 +1294,8 @@ intel_miptree_copy_slice_sw(<wbr>struct brw_context *brw,<br>
{<br>
void *src, *dst;<br>
ptrdiff_t src_stride, dst_stride;<br>
- int cpp = dst_mt->cpp;<br>
+ const unsigned cpp = dst_mt->surf.size > 0 ?<br>
+ (isl_format_get_layout(dst_mt-<wbr>>surf.format)->bpb / 8) : dst_mt->cpp;<br>
<br>
intel_miptree_map(brw, src_mt,<br>
src_level, src_layer,<br>
@@ -1355,13 +1356,28 @@ intel_miptree_copy_slice(<wbr>struct brw_context *brw,<br>
unsigned dst_level, unsigned dst_layer)<br>
<br>
{<br>
- uint32_t width = minify(src_mt->physical_<wbr>width0,<br>
- src_level - src_mt->first_level);<br>
- uint32_t height = minify(src_mt->physical_<wbr>height0,<br>
- src_level - src_mt->first_level);<br>
mesa_format format = src_mt->format;<br>
+ uint32_t width, height;<br>
+<br>
+ if (src_mt->surf.size > 0) {<br>
+ width = minify(src_mt->surf.phys_<wbr>level0_sa.width,<br>
+ src_level - src_mt->first_level);<br>
+ height = minify(src_mt->surf.phys_<wbr>level0_sa.height,<br>
+ src_level - src_mt->first_level);<br>
+<br>
+ const unsigned level_depth = src_mt->surf.dim == ISL_SURF_DIM_3D ?<br></blockquote><div><br></div><div>This needs a MAYBE_UNUSED or else we'll get warnings in release builds. Another option would be to do<br><br></div><div>if (src_mt->surf.dim == ISL_SURF_DIM_3D)<br></div><div> assert(src_layer < minify());<br></div><div>else<br></div><div> assert(src_layer < src_mt->surf.phys_level0_sa.<wbr>array_len);<br><br></div><div>I think that would actually be better.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ minify(src_mt->surf.phys_<wbr>level0_sa.depth,<br>
+ src_level - src_mt->first_level) :<br>
+ src_mt->surf.phys_level0_sa.<wbr>array_len;<br>
+ assert(src_layer < level_depth);<br>
+ } else {<br>
+ width = minify(src_mt->physical_<wbr>width0,<br>
+ src_level - src_mt->first_level);<br>
+ height = minify(src_mt->physical_<wbr>height0,<br>
+ src_level - src_mt->first_level);<br>
+ assert(src_layer < src_mt->level[src_level].<wbr>depth);<br>
+ }<br>
<br>
- assert(src_layer < src_mt->level[src_level].<wbr>depth);<br>
assert(src_mt->format == dst_mt->format);<br>
<br>
if (dst_mt->compressed) {<br>
<span class="gmail-HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>