From c468cf29a8995352edf64ec2a9ada12b62bee6b7 Mon Sep 17 00:00:00 2001 From: Rajnesh Kanwal Date: Tue, 16 Aug 2022 21:45:36 +0100 Subject: [PATCH] pvr: Implement vkCmdResolveImage2KHR API. Signed-off-by: Rajnesh Kanwal Acked-by: Karmjit Mahil Part-of: --- src/imagination/vulkan/pvr_blit.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/imagination/vulkan/pvr_blit.c b/src/imagination/vulkan/pvr_blit.c index f2d28d8..526487d 100644 --- a/src/imagination/vulkan/pvr_blit.c +++ b/src/imagination/vulkan/pvr_blit.c @@ -1944,5 +1944,25 @@ void pvr_CmdClearAttachments(VkCommandBuffer commandBuffer, void pvr_CmdResolveImage2KHR(VkCommandBuffer commandBuffer, const VkResolveImageInfo2 *pResolveImageInfo) { - assert(!"Unimplemented"); + PVR_FROM_HANDLE(pvr_image, src, pResolveImageInfo->srcImage); + PVR_FROM_HANDLE(pvr_image, dst, pResolveImageInfo->dstImage); + PVR_FROM_HANDLE(pvr_cmd_buffer, cmd_buffer, commandBuffer); + + PVR_CHECK_COMMAND_BUFFER_BUILDING_STATE(cmd_buffer); + + for (uint32_t i = 0U; i < pResolveImageInfo->regionCount; i++) { + VkImageCopy2 region = { + .sType = VK_STRUCTURE_TYPE_IMAGE_COPY_2, + .srcSubresource = pResolveImageInfo->pRegions[i].srcSubresource, + .srcOffset = pResolveImageInfo->pRegions[i].srcOffset, + .dstSubresource = pResolveImageInfo->pRegions[i].dstSubresource, + .dstOffset = pResolveImageInfo->pRegions[i].dstOffset, + .extent = pResolveImageInfo->pRegions[i].extent, + }; + + VkResult result = + pvr_copy_or_resolve_color_image_region(cmd_buffer, src, dst, ®ion); + if (result != VK_SUCCESS) + return; + } } -- 2.7.4