diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index cbbebbf6f34..90c1fffabde 100644 --- a/src/intel/vulkan/anv_formats.c +++ b/src/intel/vulkan/anv_formats.c @@ -748,28 +748,41 @@ anv_color_format_supports_drm_modifier_tiling(const struct anv_physical_device * } static VkFormatFeatureFlags2 -anv_get_compressed_emulated_format_features(const struct anv_format *anv_format, +anv_get_compressed_emulated_format_features(const struct anv_physical_device *pdevice, + const struct anv_format *anv_format, const VkImageTiling vk_tiling) { + VkFormatFeatureFlags2 flags = 0; + assert(isl_format_is_compressed(anv_format->planes[0].isl_format)); /* Require optimal tiling so that we can decompress on upload */ - if (vk_tiling == VK_IMAGE_TILING_OPTIMAL) { + switch (vk_tiling) { + case VK_IMAGE_TILING_OPTIMAL: /* Required features for compressed formats */ - return VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT | - VK_FORMAT_FEATURE_2_BLIT_SRC_BIT | - VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT | - VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT | - VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT | - VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT; - } else if (vk_tiling == VK_IMAGE_TILING_LINEAR) { + flags |= VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_BIT | + VK_FORMAT_FEATURE_2_BLIT_SRC_BIT | + VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_FILTER_LINEAR_BIT | + VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT | + VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT | + VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT; + break; + + case VK_IMAGE_TILING_LINEAR: /* Images used for transfers */ - return VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT | - VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT | - VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT; + flags |= VK_FORMAT_FEATURE_2_TRANSFER_SRC_BIT | + VK_FORMAT_FEATURE_2_TRANSFER_DST_BIT | + VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT; + break; + + default: + return 0; } - return 0; + if (anv_format_supports_indirect_copies(pdevice, anv_format)) + flags |= VK_FORMAT_FEATURE_2_COPY_IMAGE_INDIRECT_DST_BIT_KHR; + + return flags; } static VkFormatFeatureFlags2 @@ -1163,7 +1176,8 @@ anv_get_image_format_features2(const struct anv_physical_device *physical_device } if (anv_is_compressed_format_emulated(physical_device, vk_format)) { - return anv_get_compressed_emulated_format_features(anv_format, + return anv_get_compressed_emulated_format_features(physical_device, + anv_format, vk_tiling); }