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 <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17368>
This commit is contained in:
Boris Brezillon 2022-06-30 04:17:12 -07:00 committed by Marge Bot
parent 53a352e1cf
commit d132ec924d
1 changed files with 18 additions and 3 deletions

View File

@ -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;