<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Aug 8, 2016 at 11:40 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">On Wed, Aug 03, 2016 at 01:06:10PM -0700, Jason Ekstrand wrote:<br>
> We can't actually clear these images normally because we can't render to<br>
> them.  Instead, we have to manually unpack the rgb9e5 color value on the<br>
> CPU and clear it as R32_UINT.  We still have a bit of work to do to clear<br>
> non-power-of-two images, but this should get all of the power-of-two clears<br>
> working on at least Haswell.<br>
<br>
</span>Could you mention which CTS tests this fixes? That would help me to test<br>
the correctness of this change.<br></blockquote><div><br></div><div>The vulkan-cts-1.0-dev branch of the CTS has a bunch of tests to test clearing.  This fixes 3 of the dEQP-VK.api.image_clearing.clear_color_image.* tests<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=""><br>
><br>
> Cc: "12.0" <<a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.<wbr>freedesktop.org</a>><br>
> ---<br>
>  src/intel/vulkan/anv_meta_<wbr>clear.c | 16 ++++++++++++++--<br>
>  1 file changed, 14 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/anv_meta_<wbr>clear.c b/src/intel/vulkan/anv_meta_<wbr>clear.c<br>
> index fa07ec1..d8b5ce0 100644<br>
> --- a/src/intel/vulkan/anv_meta_<wbr>clear.c<br>
> +++ b/src/intel/vulkan/anv_meta_<wbr>clear.c<br>
> @@ -25,6 +25,8 @@<br>
>  #include "anv_private.h"<br>
>  #include "nir/nir_builder.h"<br>
><br>
> +#include "gallium/auxiliary/util/u_<wbr>format_rgb9e5.h"<br>
> +<br>
>  /** Vertex attributes for color clears.  */<br>
>  struct color_clear_vattrs {<br>
>     struct anv_vue_header vue_header;<br>
> @@ -760,6 +762,16 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer,<br>
>  {<br>
>     VkDevice device_h = anv_device_to_handle(cmd_<wbr>buffer->device);<br>
><br>
> +   VkFormat vk_format = image->vk_format;<br>
> +   if (vk_format == VK_FORMAT_E5B9G9R9_UFLOAT_<wbr>PACK32) {<br>
> +      /* We can't actually render to this format so we have to work around it<br>
> +       * by manualy unpacking and using R32_UINT.<br>
<br>
</span>s/manualy/manually/<br>
<div><div class="h5"><br>
> +       */<br>
> +      clear_value.color.uint32[0] =<br>
> +         float3_to_rgb9e5(clear_value.<wbr>color.float32);<br>
> +      vk_format = VK_FORMAT_R32_UINT;<br>
> +   }<br>
> +<br>
>     for (uint32_t r = 0; r < range_count; r++) {<br>
>        const VkImageSubresourceRange *range = &ranges[r];<br>
>        for (uint32_t l = 0; l < anv_get_levelCount(image, range); ++l) {<br>
> @@ -773,7 +785,7 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer,<br>
>                    .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_<wbr>CREATE_INFO,<br>
>                    .image = anv_image_to_handle(image),<br>
>                    .viewType = anv_meta_get_view_type(image),<br>
> -                  .format = image->vk_format,<br>
> +                  .format = vk_format,<br>
>                    .subresourceRange = {<br>
>                       .aspectMask = range->aspectMask,<br>
>                       .baseMipLevel = range->baseMipLevel + l,<br>
> @@ -800,7 +812,7 @@ anv_cmd_clear_image(struct anv_cmd_buffer *cmd_buffer,<br>
>                 &fb);<br>
><br>
>              VkAttachmentDescription att_desc = {<br>
> -               .format = iview.vk_format,<br>
> +               .format = vk_format,<br>
>                 .loadOp = VK_ATTACHMENT_LOAD_OP_LOAD,<br>
>                 .storeOp = VK_ATTACHMENT_STORE_OP_STORE,<br>
>                 .stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD,<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>