<p dir="ltr">On Aug 3, 2016 5:53 AM, "Lionel Landwerlin" <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a>> wrote:<br>
><br>
> We let the user believe we support some transfer destination formats<br>
> which we don't. This can lead to crashes when actually trying to use<br>
> those formats for example on<br>
> dEQP-VK.api.copy_and_blit.image_to_image.* tests.<br>
><br>
> Allow formats we can render to as meta implements transfers using<br>
> attachments.</p>
<p dir="ltr">Sadly, it's not quite that simple... Nanley and I had a long chat about this in the office last week.  I'll try and summarize here.  Let's take one particular format as an example: R9G9B9E5.  This format is required to be supported for sampling with VK_TILING_OPTIMAL but has no requirements on rendering.  We can sample from it but cannot render to it.  Since it's required to be supported in a tilled configuration, the only way the user can get data into it is through vkCopy* commands. This means it has to be supported as a transfer destination.  This means we have to support vkClearColorImage on it as well.</p>
<p dir="ltr">This implies two things: First, the correct criterion for supporting transfer operations is render, depth-stencil, *or* sampling.  Second, we really need to come up with a better clearing sorry than just "bind as a render target and draw".  While this works for most formats, there are a few where we have to bind as a different format and manually convert the data.</p>
<p dir="ltr">Make sense?</p>
<p dir="ltr">--Jason</p>
<p dir="ltr">> Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a>><br>
> Cc: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>><br>
> ---<br>
>  src/intel/vulkan/anv_formats.c | 11 +++--------<br>
>  1 file changed, 3 insertions(+), 8 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c<br>
> index b26e48a..1a3b19d 100644<br>
> --- a/src/intel/vulkan/anv_formats.c<br>
> +++ b/src/intel/vulkan/anv_formats.c<br>
> @@ -514,18 +514,13 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties(<br>
>        }<br>
>     }<br>
><br>
> -#if 0<br>
>     if (usage & VK_IMAGE_USAGE_TRANSFER_DST_BIT) {<br>
> -      if (anv_format_for_vk_format(format)->has_stencil) {<br>
> -         /* Not yet implemented because copying to a W-tiled surface is crazy<br>
> -          * hard.<br>
> -          */<br>
> -         anv_finishme("support VK_IMAGE_USAGE_TRANSFER_DST_BIT for "<br>
> -                      "stencil format");<br>
> +      /* Meta implements transfers by rendering to the attachment image. */<br>
> +      if (!(format_feature_flags & (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |<br>
> +                                    VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))) {<br>
>           goto unsupported;<br>
>        }<br>
>     }<br>
> -#endif<br>
><br>
>     if (usage & VK_IMAGE_USAGE_SAMPLED_BIT) {<br>
>        if (!(format_feature_flags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) {<br>
> --<br>
> 2.8.1<br>
><br>
> _______________________________________________<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">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>