diff --git a/src/panfrost/vulkan/panvk_vX_image_view.c b/src/panfrost/vulkan/panvk_vX_image_view.c index 66f695583cc..21ff443cd4e 100644 --- a/src/panfrost/vulkan/panvk_vX_image_view.c +++ b/src/panfrost/vulkan/panvk_vX_image_view.c @@ -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, diff --git a/src/vulkan/runtime/vk_meta.c b/src/vulkan/runtime/vk_meta.c index ea185741d5d..9ff9fe8c011 100644 --- a/src/vulkan/runtime/vk_meta.c +++ b/src/vulkan/runtime/vk_meta.c @@ -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;