mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 05:52:11 +01:00
[dxvk] Optimize meta copy barriers
This commit is contained in:
parent
fd0daa5ec7
commit
7627f6e3ed
@ -2033,9 +2033,12 @@ namespace dxvk {
|
||||
VkImageSubresourceLayers srcSubresource,
|
||||
VkOffset3D srcOffset,
|
||||
VkExtent3D extent) {
|
||||
m_barriers.recordCommands(m_cmd);
|
||||
|
||||
auto dstSubresourceRange = vk::makeSubresourceRange(dstSubresource);
|
||||
auto srcSubresourceRange = vk::makeSubresourceRange(srcSubresource);
|
||||
|
||||
if (m_barriers.isImageDirty(dstImage, dstSubresourceRange, DxvkAccess::Write)
|
||||
|| m_barriers.isImageDirty(srcImage, srcSubresourceRange, DxvkAccess::Write))
|
||||
m_barriers.recordCommands(m_cmd);
|
||||
|
||||
// Source image needs to be readable
|
||||
if (!(srcImage->info().usage & VK_IMAGE_USAGE_SAMPLED_BIT)) {
|
||||
@ -2208,21 +2211,26 @@ namespace dxvk {
|
||||
m_cmd->cmdDraw(1, tgtSubresource.layerCount, 0, 0);
|
||||
m_cmd->cmdEndRenderPass();
|
||||
|
||||
m_barriers.accessImage(
|
||||
srcImage, srcSubresourceRange,
|
||||
srcLayout,
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
|
||||
VK_ACCESS_SHADER_READ_BIT,
|
||||
srcImage->info().layout,
|
||||
srcImage->info().stages,
|
||||
srcImage->info().access);
|
||||
|
||||
m_barriers.accessImage(
|
||||
dstImage, dstSubresourceRange,
|
||||
dstImage->info().layout,
|
||||
VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, 0,
|
||||
dstImage->info().layout,
|
||||
dstImage->info().stages,
|
||||
dstImage->info().access);
|
||||
|
||||
m_cmd->trackResource(tgtImage);
|
||||
m_cmd->trackResource(srcImage);
|
||||
m_cmd->trackResource(fb);
|
||||
|
||||
// If necessary, transition source image back
|
||||
if (srcImage->info().layout != srcLayout) {
|
||||
m_barriers.accessImage(
|
||||
srcImage, srcSubresourceRange,
|
||||
srcLayout,
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT,
|
||||
VK_ACCESS_SHADER_READ_BIT,
|
||||
srcImage->info().layout,
|
||||
srcImage->info().stages,
|
||||
srcImage->info().access);
|
||||
}
|
||||
|
||||
// If necessary, copy the temporary image
|
||||
// to the original destination image
|
||||
|
@ -35,18 +35,6 @@ namespace dxvk {
|
||||
VkRenderPass DxvkMetaCopyRenderPass::createRenderPass(bool discard) const {
|
||||
auto aspect = m_dstImageView->info().aspect;
|
||||
|
||||
std::array<VkSubpassDependency, 2> subpassDeps = {{
|
||||
{ VK_SUBPASS_EXTERNAL, 0,
|
||||
m_dstImageView->imageInfo().stages,
|
||||
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
|
||||
0, VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT, 0 },
|
||||
{ 0, VK_SUBPASS_EXTERNAL,
|
||||
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT,
|
||||
m_dstImageView->imageInfo().stages,
|
||||
VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
|
||||
m_dstImageView->imageInfo().access, 0 },
|
||||
}};
|
||||
|
||||
VkAttachmentDescription attachment;
|
||||
attachment.flags = 0;
|
||||
attachment.format = m_dstImageView->info().format;
|
||||
@ -96,8 +84,8 @@ namespace dxvk {
|
||||
info.pAttachments = &attachment;
|
||||
info.subpassCount = 1;
|
||||
info.pSubpasses = &subpass;
|
||||
info.dependencyCount = subpassDeps.size();
|
||||
info.pDependencies = subpassDeps.data();
|
||||
info.dependencyCount = 0;
|
||||
info.pDependencies = nullptr;
|
||||
|
||||
VkRenderPass result = VK_NULL_HANDLE;
|
||||
if (m_vkd->vkCreateRenderPass(m_vkd->device(), &info, nullptr, &result) != VK_SUCCESS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user