From 790759dfafac752d057cd087b48d4acbe8edc81c Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 26 Sep 2024 08:42:12 +0200 Subject: [PATCH] vk/image: Fix the extent adjustment of non-compressed views When creating a non-compressed view of a compressed image, we need to divide the extent by the image block size not the view block size. Fixes: 8ddc527ba4ea ("vk/image: Fix the view extent of uncompressed views of compressed images") Signed-off-by: Boris Brezillon Reviewed-by: Faith Ekstrand Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_image_view.c | 3 ++- src/vulkan/runtime/vk_image.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_image_view.c b/src/amd/vulkan/radv_image_view.c index aa556ccb14e..85315f21530 100644 --- a/src/amd/vulkan/radv_image_view.c +++ b/src/amd/vulkan/radv_image_view.c @@ -506,7 +506,8 @@ radv_image_view_init(struct radv_image_view *iview, struct radv_device *device, .depth = image->vk.extent.depth, }; } else { - iview->extent = iview->vk.extent; + iview->extent = + vk_image_mip_level_extent(&image->vk, iview->vk.base_mip_level); } if (iview->vk.format != image->planes[iview->plane_id].format) { diff --git a/src/vulkan/runtime/vk_image.c b/src/vulkan/runtime/vk_image.c index fca763c9ae9..8dfece7e909 100644 --- a/src/vulkan/runtime/vk_image.c +++ b/src/vulkan/runtime/vk_image.c @@ -543,7 +543,7 @@ vk_image_view_init(struct vk_device *device, if (vk_format_is_compressed(image->format) && !vk_format_is_compressed(image_view->format)) { const struct util_format_description *fmt = - vk_format_description(image_view->format); + vk_format_description(image->format); /* Non-compressed view of compressed image only works for single MIP * views.