panvk, vk/meta: Move D/S sanitizing to panvk

In reality, only panvk rely on this and this breaks HK.

Signed-off-by: Mary Guillemard <mary@mary.zone>
Fixes: 42abf00f2b ("vulkan: Handle VK_IMAGE_VIEW_CREATE_DRIVER_INTERNAL_BIT_MESA automatically")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37631>
This commit is contained in:
Mary Guillemard 2025-09-30 10:20:23 +02:00 committed by Marge Bot
parent 316eca63a9
commit 095f13109f
2 changed files with 12 additions and 11 deletions

View file

@ -309,6 +309,17 @@ panvk_per_arch(CreateImageView)(VkDevice _device,
if (view == NULL)
return panvk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY);
/* vk_image_view_init() sanitizes depth/stencil formats to use the
* single-plane format, which panvk rely on. It doesn't do this with
* driver-internal images, though. We have to do that ourselves.
*/
if (view->vk.create_flags & VK_IMAGE_VIEW_CREATE_DRIVER_INTERNAL_BIT_MESA) {
if (view->vk.aspects == VK_IMAGE_ASPECT_DEPTH_BIT)
view->vk.view_format = vk_format_depth_only(view->vk.view_format);
else if (view->vk.aspects == VK_IMAGE_ASPECT_STENCIL_BIT)
view->vk.view_format = vk_format_stencil_only(view->vk.view_format);
}
enum pipe_format pfmt = vk_format_to_pipe_format(view->vk.view_format);
view->pview = (struct pan_image_view){
.format = pfmt,

View file

@ -532,7 +532,6 @@ vk_meta_create_image_view(struct vk_command_buffer *cmd,
struct vk_device *device = cmd->base.device;
const struct vk_device_dispatch_table *disp = &device->dispatch_table;
VkDevice _device = vk_device_to_handle(device);
VkImageViewCreateInfo patched_info = *info;
/* Meta must always specify view usage */
assert(vk_find_struct_const(info->pNext, IMAGE_VIEW_USAGE_CREATE_INFO));
@ -540,17 +539,8 @@ vk_meta_create_image_view(struct vk_command_buffer *cmd,
/* Meta image views are always driver-internal */
assert(info->flags & VK_IMAGE_VIEW_CREATE_DRIVER_INTERNAL_BIT_MESA);
/* vk_image_view_init() sanitizes depth/stencil formats to use the
* single-plane format, which drivers rely on. It doesn't do this with
* driver-internal images, though. We have to do that ourselves.
*/
if (info->subresourceRange.aspectMask == VK_IMAGE_ASPECT_DEPTH_BIT)
patched_info.format = vk_format_depth_only(info->format);
else if (info->subresourceRange.aspectMask == VK_IMAGE_ASPECT_STENCIL_BIT)
patched_info.format = vk_format_stencil_only(info->format);
VkResult result =
disp->CreateImageView(_device, &patched_info, NULL, image_view_out);
disp->CreateImageView(_device, info, NULL, image_view_out);
if (unlikely(result != VK_SUCCESS))
return result;