Module: Mesa Branch: main Commit: 3b006961178bdb6579219226edd10635779082be URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3b006961178bdb6579219226edd10635779082be
Author: Bas Nieuwenhuizen <[email protected]> Date: Tue Aug 17 21:56:36 2021 +0200 radv: Check format before calling depth_only/stencil_only. Breaks when we drop the fallback in those functions. Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12023> --- src/amd/vulkan/radv_image.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c index 45b5f53725a..59eca338bcc 100644 --- a/src/amd/vulkan/radv_image.c +++ b/src/amd/vulkan/radv_image.c @@ -1912,10 +1912,15 @@ radv_image_view_init(struct radv_image_view *iview, struct radv_device *device, if (iview->vk_format == VK_FORMAT_UNDEFINED) iview->vk_format = image->vk_format; + /* Split out the right aspect. Note that for internal meta code we sometimes + * use an equivalent color format for the aspect so we first have to check + * if we actually got depth/stencil formats. */ if (iview->aspect_mask == VK_IMAGE_ASPECT_STENCIL_BIT) { - iview->vk_format = vk_format_stencil_only(iview->vk_format); + if (vk_format_has_stencil(iview->vk_format)) + iview->vk_format = vk_format_stencil_only(iview->vk_format); } else if (iview->aspect_mask == VK_IMAGE_ASPECT_DEPTH_BIT) { - iview->vk_format = vk_format_depth_only(iview->vk_format); + if (vk_format_has_depth(iview->vk_format)) + iview->vk_format = vk_format_depth_only(iview->vk_format); } if (device->physical_device->rad_info.chip_class >= GFX9) {
