1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-31 14:52:11 +01:00

[dxvk] Use new barrier helpers in copyBufferToImageFb

This commit is contained in:
Philip Rebohle 2024-10-12 09:21:31 +02:00 committed by Philip Rebohle
parent d7dd80b62f
commit e21c2977df

View File

@ -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<DxvkBufferView> 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<DxvkAccess::Write>(image);
m_cmd->trackResource<DxvkAccess::Read>(buffer);