mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-14 22:29:15 +01:00
[dxvk] Use copy_commands2 functions for image copies
This commit is contained in:
parent
dc1d82deff
commit
23846ad577
@ -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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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 = ©Region;
|
||||||
|
|
||||||
|
m_cmd->cmdCopyImage(DxvkCmdBuffer::ExecBuffer, ©Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_execBarriers.accessImage(
|
m_execBarriers.accessImage(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user