mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-19 14:52:10 +01:00
[dxvk] Optimize meta copy barriers
This commit is contained in:
parent
fd0daa5ec7
commit
7627f6e3ed
@ -2033,10 +2033,13 @@ namespace dxvk {
|
|||||||
VkImageSubresourceLayers srcSubresource,
|
VkImageSubresourceLayers srcSubresource,
|
||||||
VkOffset3D srcOffset,
|
VkOffset3D srcOffset,
|
||||||
VkExtent3D extent) {
|
VkExtent3D extent) {
|
||||||
m_barriers.recordCommands(m_cmd);
|
auto dstSubresourceRange = vk::makeSubresourceRange(dstSubresource);
|
||||||
|
|
||||||
auto srcSubresourceRange = vk::makeSubresourceRange(srcSubresource);
|
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
|
// Source image needs to be readable
|
||||||
if (!(srcImage->info().usage & VK_IMAGE_USAGE_SAMPLED_BIT)) {
|
if (!(srcImage->info().usage & VK_IMAGE_USAGE_SAMPLED_BIT)) {
|
||||||
Logger::err("DxvkContext: copyImageFb: Source image not readable");
|
Logger::err("DxvkContext: copyImageFb: Source image not readable");
|
||||||
@ -2208,12 +2211,6 @@ namespace dxvk {
|
|||||||
m_cmd->cmdDraw(1, tgtSubresource.layerCount, 0, 0);
|
m_cmd->cmdDraw(1, tgtSubresource.layerCount, 0, 0);
|
||||||
m_cmd->cmdEndRenderPass();
|
m_cmd->cmdEndRenderPass();
|
||||||
|
|
||||||
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(
|
m_barriers.accessImage(
|
||||||
srcImage, srcSubresourceRange,
|
srcImage, srcSubresourceRange,
|
||||||
srcLayout,
|
srcLayout,
|
||||||
@ -2222,7 +2219,18 @@ namespace dxvk {
|
|||||||
srcImage->info().layout,
|
srcImage->info().layout,
|
||||||
srcImage->info().stages,
|
srcImage->info().stages,
|
||||||
srcImage->info().access);
|
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, copy the temporary image
|
// If necessary, copy the temporary image
|
||||||
// to the original destination image
|
// to the original destination image
|
||||||
|
@ -35,18 +35,6 @@ namespace dxvk {
|
|||||||
VkRenderPass DxvkMetaCopyRenderPass::createRenderPass(bool discard) const {
|
VkRenderPass DxvkMetaCopyRenderPass::createRenderPass(bool discard) const {
|
||||||
auto aspect = m_dstImageView->info().aspect;
|
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;
|
VkAttachmentDescription attachment;
|
||||||
attachment.flags = 0;
|
attachment.flags = 0;
|
||||||
attachment.format = m_dstImageView->info().format;
|
attachment.format = m_dstImageView->info().format;
|
||||||
@ -96,8 +84,8 @@ namespace dxvk {
|
|||||||
info.pAttachments = &attachment;
|
info.pAttachments = &attachment;
|
||||||
info.subpassCount = 1;
|
info.subpassCount = 1;
|
||||||
info.pSubpasses = &subpass;
|
info.pSubpasses = &subpass;
|
||||||
info.dependencyCount = subpassDeps.size();
|
info.dependencyCount = 0;
|
||||||
info.pDependencies = subpassDeps.data();
|
info.pDependencies = nullptr;
|
||||||
|
|
||||||
VkRenderPass result = VK_NULL_HANDLE;
|
VkRenderPass result = VK_NULL_HANDLE;
|
||||||
if (m_vkd->vkCreateRenderPass(m_vkd->device(), &info, nullptr, &result) != VK_SUCCESS)
|
if (m_vkd->vkCreateRenderPass(m_vkd->device(), &info, nullptr, &result) != VK_SUCCESS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user