From 3de0f27dd949bee9c6bee70971105a87ecb33cc3 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 11 Oct 2024 21:37:16 +0200 Subject: [PATCH] [dxvk] Use new layout transition helper in resolveImageFb --- src/dxvk/dxvk_context.cpp | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index c7de0ceea..568deb409 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -4385,15 +4385,6 @@ namespace dxvk { dstAccess |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT; } - if (dstImage->info().layout != dstLayout || doDiscard) { - m_execAcquires.accessImage( - dstImage, dstSubresourceRange, - doDiscard ? VK_IMAGE_LAYOUT_UNDEFINED - : dstImage->info().layout, - dstImage->info().stages, 0, - dstLayout, dstStages, dstAccess); - } - // Check source image layout, and try to avoid transitions if we can VkImageLayout srcLayout = srcImage->info().layout; @@ -4403,18 +4394,12 @@ namespace dxvk { ? srcImage->pickLayout(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) : srcImage->pickLayout(VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL); } - - if (srcImage->info().layout != srcLayout) { - m_execAcquires.accessImage( - srcImage, srcSubresourceRange, - srcImage->info().layout, - srcImage->info().stages, 0, - srcLayout, - VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, - VK_ACCESS_SHADER_READ_BIT); - } - m_execAcquires.recordCommands(m_cmd); + addImageLayoutTransition(*dstImage, dstSubresourceRange, + dstLayout, dstStages, dstAccess, doDiscard); + addImageLayoutTransition(*srcImage, srcSubresourceRange, srcLayout, + VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT, VK_ACCESS_2_SHADER_READ_BIT, false); + flushImageLayoutTransitions(DxvkCmdBuffer::ExecBuffer); // Create a framebuffer and pipeline for the resolve op VkFormat dstFormat = format ? format : dstImage->info().format;