[Mesa-dev] [PATCH] anv: GetDeviceImageFormatProperties: fix transfer destination formats
Jason Ekstrand
jason at jlekstrand.net
Wed Aug 3 15:01:34 UTC 2016
On Aug 3, 2016 5:53 AM, "Lionel Landwerlin" <lionel.g.landwerlin at intel.com>
wrote:
>
> We let the user believe we support some transfer destination formats
> which we don't. This can lead to crashes when actually trying to use
> those formats for example on
> dEQP-VK.api.copy_and_blit.image_to_image.* tests.
>
> Allow formats we can render to as meta implements transfers using
> attachments.
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.
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.
Make sense?
--Jason
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
> Cc: Jason Ekstrand <jason.ekstrand at intel.com>
> ---
> src/intel/vulkan/anv_formats.c | 11 +++--------
> 1 file changed, 3 insertions(+), 8 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_formats.c
b/src/intel/vulkan/anv_formats.c
> index b26e48a..1a3b19d 100644
> --- a/src/intel/vulkan/anv_formats.c
> +++ b/src/intel/vulkan/anv_formats.c
> @@ -514,18 +514,13 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties(
> }
> }
>
> -#if 0
> if (usage & VK_IMAGE_USAGE_TRANSFER_DST_BIT) {
> - if (anv_format_for_vk_format(format)->has_stencil) {
> - /* Not yet implemented because copying to a W-tiled surface is
crazy
> - * hard.
> - */
> - anv_finishme("support VK_IMAGE_USAGE_TRANSFER_DST_BIT for "
> - "stencil format");
> + /* Meta implements transfers by rendering to the attachment image.
*/
> + if (!(format_feature_flags &
(VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT |
> +
VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT))) {
> goto unsupported;
> }
> }
> -#endif
>
> if (usage & VK_IMAGE_USAGE_SAMPLED_BIT) {
> if (!(format_feature_flags & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT))
{
> --
> 2.8.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160803/e6e72c63/attachment.html>
More information about the mesa-dev
mailing list