1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-15 07:29:17 +01:00

[dxvk] Use copy_commands2 functions for image copies

This commit is contained in:
Philip Rebohle 2022-07-19 14:23:51 +02:00
parent dc1d82deff
commit 23846ad577
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 25 additions and 28 deletions

View File

@ -405,18 +405,10 @@ namespace dxvk {
void cmdCopyImage( void cmdCopyImage(
DxvkCmdBuffer cmdBuffer, DxvkCmdBuffer cmdBuffer,
VkImage srcImage, const VkCopyImageInfo2* copyInfo) {
VkImageLayout srcImageLayout,
VkImage dstImage,
VkImageLayout dstImageLayout,
uint32_t regionCount,
const VkImageCopy* pRegions) {
m_cmdBuffersUsed.set(cmdBuffer); m_cmdBuffersUsed.set(cmdBuffer);
m_vkd->vkCmdCopyImage(getCmdBuffer(cmdBuffer), m_vkd->vkCmdCopyImage2(getCmdBuffer(cmdBuffer), copyInfo);
srcImage, srcImageLayout,
dstImage, dstImageLayout,
regionCount, pRegions);
} }

View File

@ -3301,29 +3301,34 @@ namespace dxvk {
for (auto aspects = dstSubresource.aspectMask; aspects; ) { for (auto aspects = dstSubresource.aspectMask; aspects; ) {
auto aspect = vk::getNextAspect(aspects); auto aspect = vk::getNextAspect(aspects);
VkImageCopy imageRegion; VkImageCopy2 copyRegion = { VK_STRUCTURE_TYPE_IMAGE_COPY_2 };
imageRegion.srcSubresource = srcSubresource; copyRegion.srcSubresource = srcSubresource;
imageRegion.srcSubresource.aspectMask = aspect; copyRegion.srcSubresource.aspectMask = aspect;
imageRegion.srcOffset = srcOffset; copyRegion.srcOffset = srcOffset;
imageRegion.dstSubresource = dstSubresource; copyRegion.dstSubresource = dstSubresource;
imageRegion.dstSubresource.aspectMask = aspect; copyRegion.dstSubresource.aspectMask = aspect;
imageRegion.dstOffset = dstOffset; copyRegion.dstOffset = dstOffset;
imageRegion.extent = extent; copyRegion.extent = extent;
if (dstFormatInfo->flags.test(DxvkFormatFlag::MultiPlane)) { if (dstFormatInfo->flags.test(DxvkFormatFlag::MultiPlane)) {
auto plane = &dstFormatInfo->planes[vk::getPlaneIndex(aspect)]; auto plane = &dstFormatInfo->planes[vk::getPlaneIndex(aspect)];
imageRegion.srcOffset.x /= plane->blockSize.width; copyRegion.srcOffset.x /= plane->blockSize.width;
imageRegion.srcOffset.y /= plane->blockSize.height; copyRegion.srcOffset.y /= plane->blockSize.height;
imageRegion.dstOffset.x /= plane->blockSize.width; copyRegion.dstOffset.x /= plane->blockSize.width;
imageRegion.dstOffset.y /= plane->blockSize.height; copyRegion.dstOffset.y /= plane->blockSize.height;
imageRegion.extent.width /= plane->blockSize.width; copyRegion.extent.width /= plane->blockSize.width;
imageRegion.extent.height /= plane->blockSize.height; copyRegion.extent.height /= plane->blockSize.height;
} }
m_cmd->cmdCopyImage(DxvkCmdBuffer::ExecBuffer, VkCopyImageInfo2 copyInfo = { VK_STRUCTURE_TYPE_COPY_IMAGE_INFO_2 };
srcImage->handle(), srcImageLayout, copyInfo.srcImage = srcImage->handle();
dstImage->handle(), dstImageLayout, copyInfo.srcImageLayout = srcImageLayout;
1, &imageRegion); copyInfo.dstImage = dstImage->handle();
copyInfo.dstImageLayout = dstImageLayout;
copyInfo.regionCount = 1;
copyInfo.pRegions = &copyRegion;
m_cmd->cmdCopyImage(DxvkCmdBuffer::ExecBuffer, &copyInfo);
} }
m_execBarriers.accessImage( m_execBarriers.accessImage(