From 355f3188438d22712850d65e48660d8f46316dc5 Mon Sep 17 00:00:00 2001 From: Nanley Chery Date: Fri, 12 Nov 2021 13:37:32 -0500 Subject: [PATCH] anv: Allow transfer-only linear ASTC images Some apps depend on this to run. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2397 Reviewed-by: Jason Ekstrand Part-of: --- src/intel/vulkan/anv_blorp.c | 6 ++---- src/intel/vulkan/anv_formats.c | 16 +++++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index f14716c154c..a4f5ff15039 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -546,10 +546,8 @@ copy_buffer_to_image(struct anv_cmd_buffer *cmd_buffer, buffer_row_pitch; /* Some formats have additional restrictions which may cause ISL to - * fail to create a surface for us. Some examples include: - * - * 1. ASTC formats are not allowed to be LINEAR and must be tiled - * 2. YCbCr formats have to have 2-pixel aligned strides + * fail to create a surface for us. For example, YCbCr formats + * have to have 2-pixel aligned strides. * * To avoid these issues, we always bind the buffer as if it's a * "normal" format like RGBA32_UINT. Since we're using blorp_copy, diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index 82bd618d183..abaa6a46540 100644 --- a/src/intel/vulkan/anv_formats.c +++ b/src/intel/vulkan/anv_formats.c @@ -600,14 +600,16 @@ anv_get_image_format_features2(const struct intel_device_info *devinfo, enum isl_format base_isl_format = base_plane_format.isl_format; - /* ASTC textures must be in Y-tiled memory, and we reject compressed formats - * with modifiers. - */ - if (vk_tiling != VK_IMAGE_TILING_OPTIMAL && - isl_format_get_layout(plane_format.isl_format)->txc == ISL_TXC_ASTC) - return 0; - if (isl_format_supports_sampling(devinfo, plane_format.isl_format)) { + /* ASTC textures must be in Y-tiled memory, and we reject compressed + * formats with modifiers. We do however interpret ASTC textures with + * uncompressed formats during data transfers. + */ + if (vk_tiling != VK_IMAGE_TILING_OPTIMAL && + isl_format_get_layout(plane_format.isl_format)->txc == ISL_TXC_ASTC) + return VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT_KHR | + VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT_KHR; + flags |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT_KHR; if (devinfo->ver >= 9)