1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 19:24:12 +01:00

[dxvk] Allow barriers to be recorded into a specific command buffer

This commit is contained in:
Philip Rebohle 2019-04-02 12:14:15 +02:00
parent 2315d55ecc
commit e59f53abfa
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
5 changed files with 28 additions and 6 deletions

View File

@ -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());

View File

@ -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;

View File

@ -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;
}
};

View File

@ -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);
}

View File

@ -895,6 +895,7 @@ namespace dxvk {
DxvkContextState m_state;
DxvkBarrierSet m_barriers;
DxvkBarrierSet m_transfers;
DxvkBarrierSet m_transitions;
DxvkBarrierControlFlags m_barrierControl;