<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 13, 2018 at 11:29 AM, 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"><span class="">On Mon, Feb 05, 2018 at 02:34:57PM -0800, Jason Ekstrand wrote:<br>
> This unifies things a bit because we now handle depth and stencil at the<br>
> same time.  It also ensures that clears happen for input attachments.<br>
<br>
</span>As we discussed in another patch, clears are always guaranteed to happen<br>
for input attachments on LOAD_OP_CLEAR, so we can get rid of that last<br>
sentence.</blockquote><div><br></div><div>Done.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">With that change, this patch is<br>
Reviewed-by: Nanley Chery <<a href="mailto:nanley.g.chery@intel.com">nanley.g.chery@intel.com</a>><br>
<div><div class="h5"><br>
> ---<br>
>  src/intel/vulkan/genX_cmd_<wbr>buffer.c | 77 ++++++++++++++++--------------<wbr>--------<br>
>  1 file changed, 32 insertions(+), 45 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/genX_cmd_<wbr>buffer.c b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> index ab79fbf..608f5ee 100644<br>
> --- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> +++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> @@ -3524,66 +3524,51 @@ cmd_buffer_begin_subpass(<wbr>struct anv_cmd_buffer *cmd_buffer,<br>
><br>
>     VkRect2D render_area = cmd_buffer->state.render_area;<br>
>     struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;<br>
> -   for (uint32_t i = 0; i < subpass->color_count; ++i) {<br>
> -      const uint32_t a = subpass->color_attachments[i].<wbr>attachment;<br>
> +<br>
> +   for (uint32_t i = 0; i < subpass->attachment_count; ++i) {<br>
> +      const uint32_t a = subpass->attachments[i].<wbr>attachment;<br>
>        if (a == VK_ATTACHMENT_UNUSED)<br>
>           continue;<br>
><br>
>        assert(a < cmd_state->pass->attachment_<wbr>count);<br>
>        struct anv_attachment_state *att_state = &cmd_state->attachments[a];<br>
><br>
> -      if (!att_state->pending_clear_<wbr>aspects)<br>
> -         continue;<br>
> -<br>
> -      assert(att_state->pending_<wbr>clear_aspects == VK_IMAGE_ASPECT_COLOR_BIT);<br>
> -<br>
>        struct anv_image_view *iview = fb->attachments[a];<br>
>        const struct anv_image *image = iview->image;<br>
><br>
> -      /* Multi-planar images are not supported as attachments */<br>
> -      assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT);<br>
> -      assert(image->n_planes == 1);<br>
> -<br>
> -      uint32_t base_layer = iview->planes[0].isl.base_<wbr>array_layer;<br>
> -      uint32_t layer_count = fb->layers;<br>
> +      if (att_state->pending_clear_<wbr>aspects & VK_IMAGE_ASPECT_COLOR_BIT) {<br>
> +         assert(att_state->pending_<wbr>clear_aspects == VK_IMAGE_ASPECT_COLOR_BIT);<br>
><br>
> -      if (att_state->fast_clear) {<br>
> -         /* We only support fast-clears on the first layer */<br>
> -         assert(iview->planes[0].isl.<wbr>base_level == 0);<br>
> -         assert(iview->planes[0].isl.<wbr>base_array_layer == 0);<br>
> -<br>
> -         anv_image_ccs_op(cmd_buffer, image, VK_IMAGE_ASPECT_COLOR_BIT,<br>
> -                          0, 0, 1, ISL_AUX_OP_FAST_CLEAR, false);<br>
> -         base_layer++;<br>
> -         layer_count--;<br>
> -      }<br>
> -<br>
> -      if (layer_count > 0) {<br>
> +         /* Multi-planar images are not supported as attachments */<br>
> +         assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT);<br>
>           assert(image->n_planes == 1);<br>
> -         anv_image_clear_color(cmd_<wbr>buffer, image, VK_IMAGE_ASPECT_COLOR_BIT,<br>
> -                               att_state->aux_usage,<br>
> -                               iview->planes[0].isl.format,<br>
> -                               iview->planes[0].isl.swizzle,<br>
> -                               iview->planes[0].isl.base_<wbr>level,<br>
> -                               base_layer, layer_count, render_area,<br>
> -                               vk_to_isl_color(att_state-><wbr>clear_value.color));<br>
> -      }<br>
> -<br>
> -      att_state->pending_clear_<wbr>aspects = 0;<br>
> -   }<br>
><br>
> -   if (subpass->depth_stencil_<wbr>attachment.attachment != VK_ATTACHMENT_UNUSED) {<br>
> -      const uint32_t a = subpass->depth_stencil_<wbr>attachment.attachment;<br>
> +         uint32_t base_layer = iview->planes[0].isl.base_<wbr>array_layer;<br>
> +         uint32_t layer_count = fb->layers;<br>
><br>
> -      assert(a < cmd_state->pass->attachment_<wbr>count);<br>
> -      struct anv_attachment_state *att_state = &cmd_state->attachments[a];<br>
> -      struct anv_image_view *iview = fb->attachments[a];<br>
> -      const struct anv_image *image = iview->image;<br>
> +         if (att_state->fast_clear) {<br>
> +            /* We only support fast-clears on the first layer */<br>
> +            assert(iview->planes[0].isl.<wbr>base_level == 0);<br>
> +            assert(iview->planes[0].isl.<wbr>base_array_layer == 0);<br>
><br>
> -      assert(image->aspects & (VK_IMAGE_ASPECT_DEPTH_BIT |<br>
> -                               VK_IMAGE_ASPECT_STENCIL_BIT));<br>
> +            anv_image_ccs_op(cmd_buffer, image, VK_IMAGE_ASPECT_COLOR_BIT,<br>
> +                             0, 0, 1, ISL_AUX_OP_FAST_CLEAR, false);<br>
> +            base_layer++;<br>
> +            layer_count--;<br>
> +         }<br>
><br>
> -      if (att_state->pending_clear_<wbr>aspects) {<br>
> +         if (layer_count > 0) {<br>
> +            assert(image->n_planes == 1);<br>
> +            anv_image_clear_color(cmd_<wbr>buffer, image, VK_IMAGE_ASPECT_COLOR_BIT,<br>
> +                                  att_state->aux_usage,<br>
> +                                  iview->planes[0].isl.format,<br>
> +                                  iview->planes[0].isl.swizzle,<br>
> +                                  iview->planes[0].isl.base_<wbr>level,<br>
> +                                  base_layer, layer_count, render_area,<br>
> +                                  vk_to_isl_color(att_state-><wbr>clear_value.color));<br>
> +         }<br>
> +      } else if (att_state->pending_clear_<wbr>aspects & (VK_IMAGE_ASPECT_DEPTH_BIT |<br>
> +                                                     VK_IMAGE_ASPECT_STENCIL_BIT)) {<br>
>           if (att_state->fast_clear) {<br>
>              /* We currently only support HiZ for single-layer images */<br>
>              assert(iview->planes[0].isl.<wbr>base_level == 0);<br>
> @@ -3606,6 +3591,8 @@ cmd_buffer_begin_subpass(<wbr>struct anv_cmd_buffer *cmd_buffer,<br>
>                                            att_state->clear_value.<wbr>depthStencil.depth,<br>
>                                            att_state->clear_value.<wbr>depthStencil.stencil);<br>
>           }<br>
> +      } else  {<br>
> +         assert(att_state->pending_<wbr>clear_aspects == 0);<br>
>        }<br>
><br>
>        att_state->pending_clear_<wbr>aspects = 0;<br>
> --<br>
> 2.5.0.400.gff86faf<br>
><br>
</div></div>> ______________________________<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>