Skip to content

Commit

Permalink
[dxvk] Use copy_commands2 functions for image blits
Browse files Browse the repository at this point in the history
Don't expose VkImageBlit2 to client APIs since we can't easily
support pNext chains, so just convert the struct internally.
  • Loading branch information
doitsujin committed Jul 19, 2022
1 parent 563b1d7 commit ff81323
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
13 changes: 2 additions & 11 deletions src/dxvk/dxvk_cmdlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,17 +339,8 @@ namespace dxvk {
}

void cmdBlitImage(
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage dstImage,
VkImageLayout dstImageLayout,
uint32_t regionCount,
const VkImageBlit* pRegions,
VkFilter filter) {
m_vkd->vkCmdBlitImage(m_execBuffer,
srcImage, srcImageLayout,
dstImage, dstImageLayout,
regionCount, pRegions, filter);
const VkBlitImageInfo2* pBlitInfo) {
m_vkd->vkCmdBlitImage2(m_execBuffer, pBlitInfo);
}


Expand Down
23 changes: 19 additions & 4 deletions src/dxvk/dxvk_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2861,10 +2861,25 @@ namespace dxvk {
m_execAcquires.recordCommands(m_cmd);

// Perform the blit operation
m_cmd->cmdBlitImage(
srcImage->handle(), srcLayout,
dstImage->handle(), dstLayout,
1, &region, filter);
VkImageBlit2 blitRegion = { VK_STRUCTURE_TYPE_IMAGE_BLIT_2 };
blitRegion.srcSubresource = region.srcSubresource;
blitRegion.dstSubresource = region.dstSubresource;

for (uint32_t i = 0; i < 2; i++) {
blitRegion.srcOffsets[i] = region.srcOffsets[i];
blitRegion.dstOffsets[i] = region.dstOffsets[i];
}

VkBlitImageInfo2 blitInfo = { VK_STRUCTURE_TYPE_BLIT_IMAGE_INFO_2 };
blitInfo.srcImage = srcImage->handle();
blitInfo.srcImageLayout = srcLayout;
blitInfo.dstImage = dstImage->handle();
blitInfo.dstImageLayout = dstLayout;
blitInfo.regionCount = 1;
blitInfo.pRegions = &blitRegion;
blitInfo.filter = filter;

m_cmd->cmdBlitImage(&blitInfo);

m_execBarriers.accessImage(
dstImage, dstSubresourceRange, dstLayout,
Expand Down

0 comments on commit ff81323

Please sign in to comment.