<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Feb 2, 2018 at 6:55 PM, Nanley Chery <span dir="ltr"><<a href="mailto:nanleychery@gmail.com" target="_blank">nanleychery@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thu, Feb 01, 2018 at 06:31:18PM -0800, Jason Ekstrand wrote:<br>
> ---<br>
> src/intel/vulkan/anv_image.c | 14 +++++++++-----<br>
<br>
We should also update the comment in anv_image that describes 3D as<br>
having one slice per LOD.<br><div><div class="h5"></div></div></blockquote><div><br></div><div>Yup. Fixed locally. I found a couple more bugs with my branch to do aux in GENERAL layout. That one suddenly forced more resolves and pointed out some 3D bugs the other didn't.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
> src/intel/vulkan/anv_private.h | 9 ++++++++-<br>
> src/intel/vulkan/genX_cmd_<wbr>buffer.c | 34 ++++++++++++++++--------------<wbr>----<br>
> 3 files changed, 33 insertions(+), 24 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c<br>
> index 6008e3c..a3e857c 100644<br>
> --- a/src/intel/vulkan/anv_image.c<br>
> +++ b/src/intel/vulkan/anv_image.c<br>
> @@ -262,11 +262,15 @@ add_aux_state_tracking_buffer(<wbr>struct anv_image *image,<br>
> /* Clear color and fast clear type */<br>
> unsigned state_size = device->isl_dev.ss.clear_<wbr>value_size + 4;<br>
><br>
> - /* We only need to track compression on CCS_E surfaces. We don't consider<br>
> - * 3D images as actually having multiple array layers.<br>
> - */<br>
> - if (image->planes[plane].aux_<wbr>usage == ISL_AUX_USAGE_CCS_E)<br>
> - state_size += image->levels * image->array_size * 4;<br>
> + /* We only need to track compression on CCS_E surfaces. */<br>
> + if (image->planes[plane].aux_<wbr>usage == ISL_AUX_USAGE_CCS_E) {<br>
> + if (image->type == VK_IMAGE_TYPE_3D) {<br>
> + for (uint32_t l = 0; l < image->levels; l++)<br>
> + state_size += anv_minify(image->extent.<wbr>depth, l) * 4;<br>
> + } else {<br>
> + state_size += image->levels * image->array_size * 4;<br>
> + }<br>
> + }<br>
><br>
> image->planes[plane].fast_<wbr>clear_state_offset =<br>
> image->planes[plane].offset + image->planes[plane].size;<br>
> diff --git a/src/intel/vulkan/anv_<wbr>private.h b/src/intel/vulkan/anv_<wbr>private.h<br>
> index 0cd94bf..f208618 100644<br>
> --- a/src/intel/vulkan/anv_<wbr>private.h<br>
> +++ b/src/intel/vulkan/anv_<wbr>private.h<br>
> @@ -2573,8 +2573,15 @@ anv_image_get_compression_<wbr>state_addr(const struct anv_device *device,<br>
> struct anv_address addr =<br>
> anv_image_get_fast_clear_type_<wbr>addr(device, image, aspect);<br>
> addr.offset += 4; /* Go past the fast clear type */<br>
> - addr.offset += level * image->array_size * 4;<br>
> +<br>
> + if (image->type == VK_IMAGE_TYPE_3D) {<br>
> + for (uint32_t l = 0; l < image->levels; l++)<br>
> + addr.offset += anv_minify(image->extent.<wbr>depth, l) * 4;<br>
> + } else {<br>
> + addr.offset += level * image->array_size * 4;<br>
> + }<br>
> addr.offset += array_layer * 4;<br>
> +<br>
> return addr;<br>
> }<br>
><br>
> diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> index e29228d..b4b6b7d 100644<br>
> --- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> +++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> @@ -632,14 +632,8 @@ anv_cmd_predicated_ccs_<wbr>resolve(struct anv_cmd_buffer *cmd_buffer,<br>
> mip.CompareOperation = COMPARE_SRCS_EQUAL;<br>
> }<br>
><br>
> - if (image->type == VK_IMAGE_TYPE_3D) {<br>
> - anv_image_ccs_op(cmd_buffer, image, aspect, level,<br>
> - 0, anv_minify(image->extent.<wbr>depth, level),<br>
> - resolve_op, true);<br>
> - } else {<br>
> - anv_image_ccs_op(cmd_buffer, image, aspect, level,<br>
> - array_layer, 1, resolve_op, true);<br>
> - }<br>
> + anv_image_ccs_op(cmd_buffer, image, aspect, level,<br>
> + array_layer, 1, resolve_op, true);<br>
> }<br>
><br>
> void<br>
> @@ -836,9 +830,6 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,<br>
> base_layer, layer_count);<br>
> }<br>
><br>
> - if (image->type == VK_IMAGE_TYPE_3D)<br>
> - base_layer = 0;<br>
> -<br>
> if (base_layer >= anv_image_aux_layers(image, aspect, base_level))<br>
> return;<br>
><br>
> @@ -897,10 +888,6 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,<br>
> uint32_t level_layer_count =<br>
> MIN2(layer_count, anv_image_aux_layers(image, aspect, level));<br>
><br>
> - /* A transition of a 3D subresource works on all slices. */<br>
> - if (image->type == VK_IMAGE_TYPE_3D)<br>
> - level_layer_count = anv_minify(image->extent.<wbr>depth, level);<br>
> -<br>
> anv_image_ccs_op(cmd_buffer, image, aspect, level,<br>
> base_layer, level_layer_count,<br>
> ISL_AUX_OP_AMBIGUATE, false);<br>
> @@ -994,7 +981,10 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,<br>
><br>
> for (uint32_t l = 0; l < level_count; l++) {<br>
> uint32_t level = base_level + l;<br>
> - for (uint32_t a = 0; a < layer_count; a++) {<br>
> + uint32_t level_layer_count =<br>
> + MIN2(layer_count, anv_image_aux_layers(image, aspect, level));<br>
> +<br>
> + for (uint32_t a = 0; a < level_layer_count; a++) {<br>
> uint32_t array_layer = base_layer + a;<br>
> anv_cmd_predicated_ccs_<wbr>resolve(cmd_buffer, image, aspect,<br>
> level, array_layer, resolve_op,<br>
> @@ -1663,12 +1653,20 @@ void genX(CmdPipelineBarrier)(<br>
> anv_image_expand_aspects(<wbr>image, range->aspectMask);<br>
> uint32_t aspect_bit;<br>
><br>
> + uint32_t base_layer, layer_count;<br>
> + if (image->type == VK_IMAGE_TYPE_3D) {<br>
> + base_layer = 0;<br>
> + layer_count = anv_minify(image->extent.<wbr>depth, range->baseMipLevel);<br>
> + } else {<br>
> + base_layer = range->baseArrayLayer;<br>
> + layer_count = anv_get_layerCount(image, range);<br>
> + }<br>
> +<br>
<br>
</div></div>Do we also need to do this for subpass transitions?<span class=""><br></span></blockquote><div><br></div><div>No. Subpass transitions pull from the image view and the layer range there is a range in 3D slices.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
> anv_foreach_image_aspect_bit(<wbr>aspect_bit, image, color_aspects) {<br>
> transition_color_buffer(cmd_<wbr>buffer, image, 1UL << aspect_bit,<br>
> range->baseMipLevel,<br>
> anv_get_levelCount(image, range),<br>
> - range->baseArrayLayer,<br>
> - anv_get_layerCount(image, range),<br>
> + base_layer, layer_count,<br>
> pImageMemoryBarriers[i].<wbr>oldLayout,<br>
> pImageMemoryBarriers[i].<wbr>newLayout);<br>
> }<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</span>> ______________________________<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>
</blockquote></div><br></div></div>