tu: Fix conditional check in tu_image_view_init

Only call tu6_plane_format for VK_FORMAT_D32_SFLOAT_S8_UINT in tu_image_view_init.
vk_format is always a single plane format here but checking the aspect mask wasn't enough.
It was possible for e.g. R8_UNORM to not have VK_IMAGE_ASPECT_COLOR_BIT apsect mask but a
PLANE aspect mask in formats like G8_B8_R8_3PLANE_420_UNORM.

This was masked by the default case in tu6_plane_format, which just returned vk_format_to_pipe_format
anyway without checking the plane index.

We need to fix this for when we switch tu6_plane_format to using vk_format_get_plane_format, where we
would otherwise trip an assert.

Signed-off-by: Valentine Burley <valentine.burley@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31304>
This commit is contained in:
Valentine Burley 2024-09-02 23:10:44 +02:00 committed by Marge Bot
parent 7bd97313e5
commit 39d943874e

View file

@ -208,7 +208,7 @@ tu_image_view_init(struct tu_device *device,
layouts[0] = &image->layout[tu6_plane_index(image->vk.format, aspect_mask)];
enum pipe_format format;
if (aspect_mask != VK_IMAGE_ASPECT_COLOR_BIT)
if (vk_format == VK_FORMAT_D32_SFLOAT_S8_UINT)
format = tu6_plane_format(vk_format, tu6_plane_index(vk_format, aspect_mask));
else
format = vk_format_to_pipe_format(vk_format);