From 7b84c8d6ea1f66e0c637db962f49ecd2f977bd48 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 28 Sep 2023 10:29:52 -0700 Subject: [PATCH] anv: fix up image views for emulated formats When the view format is the same as the image format, and the format is emulated, change the format to the decompressed format. Signed-off-by: Chia-I Wu Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/anv_image.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 6a27a1d6a3a..036d0bb0b5f 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -3167,9 +3167,14 @@ anv_image_view_init(struct anv_device *device, anv_foreach_image_aspect_bit(iaspect_bit, image, iview->vk.aspects) { const uint32_t vplane = anv_aspect_to_plane(iview->vk.aspects, 1UL << iaspect_bit); - struct anv_format_plane format; - format = anv_get_format_plane(device->info, iview->vk.view_format, - vplane, image->vk.tiling); + + VkFormat view_format = iview->vk.view_format; + if (anv_is_format_emulated(device->physical, view_format)) { + assert(image->emu_plane_format != VK_FORMAT_UNDEFINED); + view_format = vk_texcompress_astc_emulation_format(view_format); + } + const struct anv_format_plane format = anv_get_format_plane( + device->info, view_format, vplane, image->vk.tiling); iview->planes[vplane].isl = (struct isl_view) { .format = format.isl_format,