Module: Mesa Branch: main Commit: 99e54c39f66c6d63a84a50f720f1b3cbccb79f98 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=99e54c39f66c6d63a84a50f720f1b3cbccb79f98
Author: Chia-I Wu <[email protected]> Date: Wed Sep 13 16:23:45 2023 -0700 radv: simplify view format override for emulated formats Override the view format to the format of plane 1 when the view format is also emulated. There is no functional change. v2: check iview->vk.format directly (@yogeshmohan) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25071> --- src/amd/vulkan/radv_image.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index 88aa4c07b10..5a45d09e320 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -2168,14 +2168,12 @@ radv_image_view_init(struct radv_image_view *iview, struct radv_device *device, plane_count = vk_format_get_plane_count(iview->vk.format); } - if (radv_is_format_emulated(device->physical_device, image->vk.format)) { - const struct util_format_description *desc = vk_format_description(iview->vk.format); - if (desc->layout == UTIL_FORMAT_LAYOUT_ETC) { - iview->plane_id = 1; - iview->vk.view_format = vk_texcompress_etc2_emulation_format(iview->vk.format); - iview->vk.format = vk_texcompress_etc2_emulation_format(iview->vk.format); - } - + /* when the view format is emulated, redirect the view to the hidden plane 1 */ + if (radv_is_format_emulated(device->physical_device, iview->vk.format)) { + assert(radv_is_format_emulated(device->physical_device, image->vk.format)); + iview->plane_id = 1; + iview->vk.view_format = image->planes[iview->plane_id].format; + iview->vk.format = image->planes[iview->plane_id].format; plane_count = 1; }
