<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 24, 2017 at 7:56 AM, Juan A. Suarez Romero <span dir="ltr"><<a href="mailto:jasuarez@igalia.com" target="_blank">jasuarez@igalia.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"><span class="gmail-">On Tue, 2017-04-11 at 07:54 -0700, Jason Ekstrand wrote:<br>
</span><span class="gmail-">> The Vulkan driver was originally written under the assumption that<br>
> VK_ATTACHMENT_UNUSED was basically just for depth-stencil attachments.<br>
> However, the way things fell together, VK_ATTACHMENT_UNUSED can be used<br>
> anywhere in the subpass description.  The blorp-based clear and resolve<br>
> code has a bunch of places where we walk lists of attachments and we<br>
> weren't handling VK_ATTACHMENT_UNUSED everywhere.  This commit should<br>
> fix all of them.<br>
><br>
> Cc: "13.0 17.0" <<a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.<wbr>freedesktop.org</a>><br>
> ---<br>
>  src/intel/vulkan/anv_blorp.c | 30 +++++++++++++++++++++++++-----<br>
>  1 file changed, 25 insertions(+), 5 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c<br>
> index 72a468a..d27132a 100644<br>
> --- a/src/intel/vulkan/anv_blorp.c<br>
> +++ b/src/intel/vulkan/anv_blorp.c<br>
> @@ -1148,6 +1148,9 @@ anv_cmd_buffer_flush_<wbr>attachments(struct anv_cmd_buffer *cmd_buffer,<br>
><br>
>     for (uint32_t i = 0; i < subpass->color_count; ++i) {<br>
>        uint32_t att = subpass->color_attachments[i].<wbr>attachment;<br>
> +      if (att == VK_ATTACHMENT_UNUSED)<br>
> +         continue;<br>
> +<br>
<br>
<br>
</span>I'm realizing that the above hunk is not present in the master branch,<br>
though it was also in the patch submitted to the mailing list.<br>
<br>
<br>
Didn't see any reference to remove it.<br>
<br>
Jason, can I ignore that hunk in the stable branch too?<br></blockquote><div><br></div><div>I don't believe so.  anv_cmd_buffer_flush_attachments was removed in bc68aa42bd7fcbbf5d388a3804c3b41cc71812a8<br><br></div><div>--Jason<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"><div class="gmail-HOEnZb"><div class="gmail-h5">
>        assert(att < pass->attachment_count);<br>
>        if (attachment_needs_flush(cmd_<wbr>buffer, &pass->attachments[att], stage)) {<br>
>           cmd_buffer->state.pending_<wbr>pipe_bits |=<br>
> @@ -1175,14 +1178,19 @@ subpass_needs_clear(const struct anv_cmd_buffer *cmd_buffer)<br>
><br>
>     for (uint32_t i = 0; i < cmd_state->subpass->color_<wbr>count; ++i) {<br>
>        uint32_t a = cmd_state->subpass->color_<wbr>attachments[i].attachment;<br>
> +      if (a == VK_ATTACHMENT_UNUSED)<br>
> +         continue;<br>
> +<br>
> +      assert(a < cmd_state->pass->attachment_<wbr>count);<br>
>        if (cmd_state->attachments[a].<wbr>pending_clear_aspects) {<br>
>           return true;<br>
>        }<br>
>     }<br>
><br>
> -   if (ds != VK_ATTACHMENT_UNUSED &&<br>
> -       cmd_state->attachments[ds].<wbr>pending_clear_aspects) {<br>
> -      return true;<br>
> +   if (ds != VK_ATTACHMENT_UNUSED) {<br>
> +      assert(ds < cmd_state->pass->attachment_<wbr>count);<br>
> +      if (cmd_state->attachments[ds].<wbr>pending_clear_aspects)<br>
> +         return true;<br>
>     }<br>
><br>
>     return false;<br>
> @@ -1214,6 +1222,10 @@ anv_cmd_buffer_clear_subpass(<wbr>struct anv_cmd_buffer *cmd_buffer)<br>
>     struct anv_framebuffer *fb = cmd_buffer->state.framebuffer;<br>
>     for (uint32_t i = 0; i < cmd_state->subpass->color_<wbr>count; ++i) {<br>
>        const uint32_t a = cmd_state->subpass->color_<wbr>attachments[i].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>
> @@ -1273,6 +1285,7 @@ anv_cmd_buffer_clear_subpass(<wbr>struct anv_cmd_buffer *cmd_buffer)<br>
>     }<br>
><br>
>     const uint32_t ds = cmd_state->subpass->depth_<wbr>stencil_attachment.attachment;<br>
> +   assert(ds == VK_ATTACHMENT_UNUSED || ds < cmd_state->pass->attachment_<wbr>count);<br>
><br>
>     if (ds != VK_ATTACHMENT_UNUSED &&<br>
>         cmd_state->attachments[ds].<wbr>pending_clear_aspects) {<br>
> @@ -1578,8 +1591,12 @@ anv_cmd_buffer_resolve_<wbr>subpass(struct anv_cmd_buffer *cmd_buffer)<br>
>     blorp_batch_init(&cmd_buffer-><wbr>device->blorp, &batch, cmd_buffer, 0);<br>
><br>
>     for (uint32_t i = 0; i < subpass->color_count; ++i) {<br>
> -      ccs_resolve_attachment(cmd_<wbr>buffer, &batch,<br>
> -                             subpass->color_attachments[i].<wbr>attachment);<br>
> +      const uint32_t att = subpass->color_attachments[i].<wbr>attachment;<br>
> +      if (att == VK_ATTACHMENT_UNUSED)<br>
> +         continue;<br>
> +<br>
> +      assert(att < cmd_buffer->state.pass-><wbr>attachment_count);<br>
> +      ccs_resolve_attachment(cmd_<wbr>buffer, &batch, att);<br>
>     }<br>
><br>
>     anv_cmd_buffer_flush_<wbr>attachments(cmd_buffer, SUBPASS_STAGE_DRAW);<br>
> @@ -1592,6 +1609,9 @@ anv_cmd_buffer_resolve_<wbr>subpass(struct anv_cmd_buffer *cmd_buffer)<br>
>           if (dst_att == VK_ATTACHMENT_UNUSED)<br>
>              continue;<br>
><br>
> +         assert(src_att < cmd_buffer->state.pass-><wbr>attachment_count);<br>
> +         assert(dst_att < cmd_buffer->state.pass-><wbr>attachment_count);<br>
> +<br>
>           if (cmd_buffer->state.<wbr>attachments[dst_att].pending_<wbr>clear_aspects) {<br>
>              /* From the Vulkan 1.0 spec:<br>
>               *<br>
</div></div></blockquote></div><br></div></div>