From e21c2977df1f787247c9030136240f1f8306e651 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 12 Oct 2024 09:21:31 +0200 Subject: [PATCH] [dxvk] Use new barrier helpers in copyBufferToImageFb --- src/dxvk/dxvk_context.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 84fb3a415..adadcc77e 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -2870,8 +2870,7 @@ namespace dxvk { this->prepareImage(image, vk::makeSubresourceRange(imageSubresource)); - if (m_execBarriers.isImageDirty(image, vk::makeSubresourceRange(imageSubresource), DxvkAccess::Write)) - m_execBarriers.recordCommands(m_cmd); + flushPendingAccesses(*image, vk::makeSubresourceRange(imageSubresource), DxvkAccess::Write); auto formatInfo = lookupFormatInfo(bufferFormat); @@ -2905,6 +2904,8 @@ namespace dxvk { Rc bufferView = buffer->createView(bufferViewInfo); VkBufferView bufferViewHandle = bufferView->handle(); + flushPendingAccesses(*bufferView, DxvkAccess::Read); + // Create image view to render to bool discard = image->isFullSubresource(imageSubresource, imageExtent); bool isDepthStencil = imageSubresource.aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT); @@ -2973,12 +2974,6 @@ namespace dxvk { if (image->formatInfo()->aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) renderingInfo.pStencilAttachment = &attachment; - DxvkBufferSliceHandle bufferSlice = buffer->getSliceHandle( - bufferOffset, slicePitch * renderingInfo.layerCount); - - if (m_execBarriers.isBufferDirty(bufferSlice, DxvkAccess::Read)) - m_execBarriers.recordCommands(m_cmd); - m_cmd->cmdBeginRendering(&renderingInfo); // Set up viewport and scissor state @@ -3077,16 +3072,13 @@ namespace dxvk { m_cmd->cmdEndRendering(); - m_execBarriers.accessImage(image, - vk::makeSubresourceRange(imageSubresource), - imageLayout, stages, access, - image->info().layout, image->info().stages, image->info().access); + accessImage(DxvkCmdBuffer::ExecBuffer, + *image, vk::makeSubresourceRange(imageSubresource), + imageLayout, stages, access); - m_execBarriers.accessBuffer(bufferSlice, - VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, - VK_ACCESS_SHADER_READ_BIT, - buffer->info().stages, - buffer->info().access); + accessBuffer(DxvkCmdBuffer::ExecBuffer, *bufferView, + VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT, + VK_ACCESS_2_SHADER_READ_BIT); m_cmd->trackResource(image); m_cmd->trackResource(buffer);