<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Feb 12, 2018 at 5:11 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">On Mon, Feb 12, 2018 at 04:35:20PM -0800, Jason Ekstrand wrote:<br>
> Previously, we just used all the channels regardless of the format.<br>
> This is less than ideal because some channels may have undefined values<br>
> and this should be ok from the client's perspective. Even though the<br>
> driver should do the correct thing regardless of what is in the<br>
> undefined value, it makes things less deterministic. In particular, the<br>
> driver may choose to fast-clear or not based on undefined values. This<br>
> level of nondeterminism is bad.<br>
><br>
> Cc: <a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.<wbr>org</a><br>
> ---<br>
> src/intel/vulkan/genX_cmd_<wbr>buffer.c | 47 ++++++++++++++++--------------<wbr>--------<br>
> 1 file changed, 20 insertions(+), 27 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 99854eb..a574024 100644<br>
> --- a/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> +++ b/src/intel/vulkan/genX_cmd_<wbr>buffer.c<br>
> @@ -202,24 +202,6 @@ add_image_view_relocs(struct anv_cmd_buffer *cmd_buffer,<br>
> }<br>
> }<br>
><br>
> -static bool<br>
> -color_is_zero_one(<wbr>VkClearColorValue value, enum isl_format format)<br>
> -{<br>
> - if (isl_format_has_int_channel(<wbr>format)) {<br>
> - for (unsigned i = 0; i < 4; i++) {<br>
> - if (value.int32[i] != 0 && value.int32[i] != 1)<br>
> - return false;<br>
> - }<br>
> - } else {<br>
> - for (unsigned i = 0; i < 4; i++) {<br>
> - if (value.float32[i] != 0.0f && value.float32[i] != 1.0f)<br>
> - return false;<br>
> - }<br>
> - }<br>
> -<br>
> - return true;<br>
> -}<br>
> -<br>
> static void<br>
> color_attachment_compute_aux_<wbr>usage(struct anv_device * device,<br>
> struct anv_cmd_state * cmd_state,<br>
> @@ -294,13 +276,26 @@ color_attachment_compute_aux_<wbr>usage(struct anv_device * device,<br>
><br>
> assert(iview->image->planes[0]<wbr>.aux_surface.isl.usage & ISL_SURF_USAGE_CCS_BIT);<br>
><br>
> + const struct isl_format_layout *view_fmtl =<br>
> + isl_format_get_layout(iview-><wbr>planes[0].isl.format);<br>
> + union isl_color_value clear_color = {};<br>
<br>
</div></div>Is this initializer valid?<span class="gmail-"><br></span></blockquote><div><br></div><div>It's a GCC extension (also supported by clang), but yes.<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"><span class="gmail-">
> +<br>
> +#define COPY_CLEAR_COLOR_CHANNEL(c, i) \<br>
> + if (view_fmtl->channels.c.bits) \<br>
> + clear_color.u32[i] = att_state->clear_value.color.<wbr>uint32[i]<br>
> +<br>
> + COPY_CLEAR_COLOR_CHANNEL(r, 0);<br>
> + COPY_CLEAR_COLOR_CHANNEL(g, 1);<br>
> + COPY_CLEAR_COLOR_CHANNEL(b, 2);<br>
> + COPY_CLEAR_COLOR_CHANNEL(a, 3);<br>
> +<br>
> +#undef COPY_CLEAR_COLOR_CHANNEL<br>
> +<br>
> att_state->clear_color_is_<wbr>zero_one =<br>
> - color_is_zero_one(att_state-><wbr>clear_value.color, iview->planes[0].isl.format);<br>
> + isl_color_value_is_zero_one(*<wbr>fast_clear_color,<br>
<br>
</span>Should this be clear_color?<span class="gmail-"><br></span></blockquote><div><br></div><div>Yes it should. Fixed locally.<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"><span class="gmail-">
> + iview->planes[0].isl.format);<br>
> att_state->clear_color_is_zero =<br>
> - att_state->clear_value.color.<wbr>uint32[0] == 0 &&<br>
> - att_state->clear_value.color.<wbr>uint32[1] == 0 &&<br>
> - att_state->clear_value.color.<wbr>uint32[2] == 0 &&<br>
> - att_state->clear_value.color.<wbr>uint32[3] == 0;<br>
> + isl_color_value_is_zero(*fast_<wbr>clear_color, iview->planes[0].isl.format);<br>
><br>
<br>
</span>Should this be clear_color?<br></blockquote><div><br>Yes it should. Fixed locally. This caused a lot of fails. I don't know how I didn't catch it. :(<br><br></div><div>Do you want a v2?<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">
<br>
-Nanley<br>
<span class="gmail-"><br>
> if (att_state->pending_clear_<wbr>aspects == VK_IMAGE_ASPECT_COLOR_BIT) {<br>
> /* Start by getting the fast clear type. We use the first subpass<br>
> @@ -358,10 +353,8 @@ color_attachment_compute_aux_<wbr>usage(struct anv_device * device,<br>
> "LOAD_OP_CLEAR. Only fast-clearing the first slice");<br>
> }<br>
><br>
> - if (att_state->fast_clear) {<br>
> - memcpy(fast_clear_color->u32, att_state->clear_value.color.<wbr>uint32,<br>
> - sizeof(fast_clear_color->u32))<wbr>;<br>
> - }<br>
> + if (att_state->fast_clear)<br>
> + *fast_clear_color = clear_color;<br>
> } else {<br>
> att_state->fast_clear = false;<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>