diff --git a/src/dxvk/dxvk_barrier.cpp b/src/dxvk/dxvk_barrier.cpp index e7aed3d9..ba97db6f 100644 --- a/src/dxvk/dxvk_barrier.cpp +++ b/src/dxvk/dxvk_barrier.cpp @@ -2,8 +2,16 @@ namespace dxvk { - DxvkBarrierSet:: DxvkBarrierSet() { } - DxvkBarrierSet::~DxvkBarrierSet() { } + DxvkBarrierSet:: DxvkBarrierSet(DxvkCmdBuffer cmdBuffer) + : m_cmdBuffer(cmdBuffer) { + + } + + + DxvkBarrierSet::~DxvkBarrierSet() { + + } + void DxvkBarrierSet::accessBuffer( const DxvkBufferSliceHandle& bufSlice, @@ -184,7 +192,7 @@ namespace dxvk { pMemBarrier = &memBarrier; commandList->cmdPipelineBarrier( - srcFlags, dstFlags, 0, + m_cmdBuffer, srcFlags, dstFlags, 0, pMemBarrier ? 1 : 0, pMemBarrier, m_bufBarriers.size(), m_bufBarriers.data(), m_imgBarriers.size(), m_imgBarriers.data()); diff --git a/src/dxvk/dxvk_barrier.h b/src/dxvk/dxvk_barrier.h index 4c0054d1..3673920e 100644 --- a/src/dxvk/dxvk_barrier.h +++ b/src/dxvk/dxvk_barrier.h @@ -17,7 +17,7 @@ namespace dxvk { public: - DxvkBarrierSet(); + DxvkBarrierSet(DxvkCmdBuffer cmdBuffer); ~DxvkBarrierSet(); void accessBuffer( @@ -80,6 +80,8 @@ namespace dxvk { VkImageSubresourceRange subres; DxvkAccessFlags access; }; + + DxvkCmdBuffer m_cmdBuffer; VkPipelineStageFlags m_srcStages = 0; VkPipelineStageFlags m_dstStages = 0; diff --git a/src/dxvk/dxvk_cmdlist.h b/src/dxvk/dxvk_cmdlist.h index 4bfdb2b5..2bf4329b 100644 --- a/src/dxvk/dxvk_cmdlist.h +++ b/src/dxvk/dxvk_cmdlist.h @@ -541,6 +541,7 @@ namespace dxvk { void cmdPipelineBarrier( + DxvkCmdBuffer cmdBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, @@ -550,7 +551,9 @@ namespace dxvk { const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers) { - m_vkd->vkCmdPipelineBarrier(m_execBuffer, + m_cmdBuffersUsed.set(cmdBuffer); + + m_vkd->vkCmdPipelineBarrier(getCmdBuffer(cmdBuffer), srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, @@ -720,6 +723,10 @@ namespace dxvk { DxvkGpuQueryTracker m_gpuQueryTracker; DxvkBufferTracker m_bufferTracker; DxvkStatCounters m_statCounters; + + VkCommandBuffer getCmdBuffer(DxvkCmdBuffer cmdBuffer) const { + return cmdBuffer == DxvkCmdBuffer::ExecBuffer ? m_execBuffer : m_initBuffer; + } }; diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index d527b127..494c7852 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -22,6 +22,9 @@ namespace dxvk { m_metaCopy (metaCopyObjects), m_metaMipGen (metaMipGenObjects), m_metaPack (metaPackObjects), + m_barriers (DxvkCmdBuffer::ExecBuffer), + m_transfers (DxvkCmdBuffer::InitBuffer), + m_transitions (DxvkCmdBuffer::ExecBuffer), m_queryManager(gpuQueryPool) { } @@ -3843,7 +3846,8 @@ namespace dxvk { barrier.srcAccessMask = srcAccess; barrier.dstAccessMask = dstAccess; - m_cmd->cmdPipelineBarrier(srcStages, dstStages, + m_cmd->cmdPipelineBarrier( + DxvkCmdBuffer::ExecBuffer, srcStages, dstStages, 0, 1, &barrier, 0, nullptr, 0, nullptr); } diff --git a/src/dxvk/dxvk_context.h b/src/dxvk/dxvk_context.h index 7ae2168a..e29ae563 100644 --- a/src/dxvk/dxvk_context.h +++ b/src/dxvk/dxvk_context.h @@ -895,6 +895,7 @@ namespace dxvk { DxvkContextState m_state; DxvkBarrierSet m_barriers; + DxvkBarrierSet m_transfers; DxvkBarrierSet m_transitions; DxvkBarrierControlFlags m_barrierControl;