v3dv: return early on image to buffer blit copies if image is linear

This path uses a shader blit to implement the copy which is only
supported for tiled images (except 1D). While blit_shader() already
checks for this, this path does a lot of heavy lifting to prepare for
the blit_shader call so we rather avoid that if possible when we know
blit_shader won't be able to implement the blit.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15342>
This commit is contained in:
Iago Toral Quiroga
2022-03-15 10:56:31 +01:00
committed by Marge Bot
parent 397f4963ed
commit 0590ce1362

View File

@@ -447,6 +447,15 @@ copy_image_to_buffer_blit(struct v3dv_cmd_buffer *cmd_buffer,
{
bool handled = false;
/* This path uses a shader blit which doesn't support linear images. Return
* early to avoid all te heavy lifting in preparation for the blit_shader()
* call that is bound to fail in that scenario.
*/
if (image->vk.tiling == VK_IMAGE_TILING_LINEAR &&
image->vk.image_type != VK_IMAGE_TYPE_1D) {
return handled;
}
/* Generally, the bpp of the data in the buffer matches that of the
* source image. The exception is the case where we are copying
* stencil (8bpp) to a combined d24s8 image (32bpp).
@@ -3817,8 +3826,10 @@ blit_shader(struct v3dv_cmd_buffer *cmd_buffer,
!vk_format_is_depth_or_stencil(dst_format));
/* Can't sample from linear images */
if (src->vk.tiling == VK_IMAGE_TILING_LINEAR && src->vk.image_type != VK_IMAGE_TYPE_1D)
if (src->vk.tiling == VK_IMAGE_TILING_LINEAR &&
src->vk.image_type != VK_IMAGE_TYPE_1D) {
return false;
}
VkImageBlit2KHR region = *_region;
/* Rewrite combined D/S blits to compatible color blits */