From: Boris Brezillon Date: Thu, 30 Jun 2022 11:17:12 +0000 (-0700) Subject: dzn: Support native image copies when formats are compatible X-Git-Tag: upstream/22.3.5~6605 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d132ec924d462a4f1a4cb2ba317d4d29c60931aa;p=platform%2Fupstream%2Fmesa.git dzn: Support native image copies when formats are compatible CopyTextureRegion() works fine if the formats belong to the same group (matching the same _TYPELESS type), so let's avoid creating a temporary resource in that case. Reviewed-by: Jesse Natalie Part-of: --- diff --git a/src/microsoft/vulkan/dzn_cmd_buffer.c b/src/microsoft/vulkan/dzn_cmd_buffer.c index a1bc1fc..123d643 100644 --- a/src/microsoft/vulkan/dzn_cmd_buffer.c +++ b/src/microsoft/vulkan/dzn_cmd_buffer.c @@ -3013,9 +3013,24 @@ dzn_CmdCopyImage2(VkCommandBuffer commandBuffer, assert(src->vk.samples == dst->vk.samples); - bool requires_temp_res = src->vk.format != dst->vk.format && - src->vk.tiling != VK_IMAGE_TILING_LINEAR && - dst->vk.tiling != VK_IMAGE_TILING_LINEAR; + bool requires_temp_res = false; + + for (uint32_t i = 0; i < info->regionCount; i++) { + const VkImageCopy2 *region = &info->pRegions[i]; + + dzn_foreach_aspect(aspect, region->srcSubresource.aspectMask) { + assert(aspect & region->dstSubresource.aspectMask); + + if (!dzn_image_formats_are_compatible(device, src->vk.format, dst->vk.format, + VK_IMAGE_USAGE_TRANSFER_SRC_BIT, aspect) && + src->vk.tiling != VK_IMAGE_TILING_LINEAR && + dst->vk.tiling != VK_IMAGE_TILING_LINEAR) { + requires_temp_res = true; + break; + } + } + } + bool use_blit = false; if (src->vk.samples > 1) { use_blit = requires_temp_res;