From 2b812f07c14e694c855ad92f67161853c3472b4d Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 26 Oct 2019 03:25:11 +0200 Subject: [PATCH] [dxvk] Move finalizeDraw into commitGraphicsState There is no readon to perform this after the draw anymore. --- src/dxvk/dxvk_context.cpp | 40 +++++++++++---------------------------- src/dxvk/dxvk_context.h | 5 +---- 2 files changed, 12 insertions(+), 33 deletions(-) diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 82b09d2c2..5a2b62bdb 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -1419,12 +1419,10 @@ namespace dxvk { uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) { - if (this->commitGraphicsState()) { + if (this->commitGraphicsState()) { m_cmd->cmdDraw( vertexCount, instanceCount, firstVertex, firstInstance); - - this->finalizeDraw(); } m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); @@ -1435,15 +1433,13 @@ namespace dxvk { VkDeviceSize offset, uint32_t count, uint32_t stride) { - if (this->commitGraphicsState()) { + if (this->commitGraphicsState()) { auto descriptor = m_state.id.argBuffer.getDescriptor(); m_cmd->cmdDrawIndirect( descriptor.buffer.buffer, descriptor.buffer.offset + offset, count, stride); - - this->finalizeDraw(); } m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); @@ -1455,7 +1451,7 @@ namespace dxvk { VkDeviceSize countOffset, uint32_t maxCount, uint32_t stride) { - if (this->commitGraphicsState()) { + if (this->commitGraphicsState()) { auto argDescriptor = m_state.id.argBuffer.getDescriptor(); auto cntDescriptor = m_state.id.cntBuffer.getDescriptor(); @@ -1465,8 +1461,6 @@ namespace dxvk { cntDescriptor.buffer.buffer, cntDescriptor.buffer.offset + countOffset, maxCount, stride); - - this->finalizeDraw(); } m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); @@ -1479,13 +1473,11 @@ namespace dxvk { uint32_t firstIndex, uint32_t vertexOffset, uint32_t firstInstance) { - if (this->commitGraphicsState()) { + if (this->commitGraphicsState()) { m_cmd->cmdDrawIndexed( indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); - - this->finalizeDraw(); } m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); @@ -1496,15 +1488,13 @@ namespace dxvk { VkDeviceSize offset, uint32_t count, uint32_t stride) { - if (this->commitGraphicsState()) { + if (this->commitGraphicsState()) { auto descriptor = m_state.id.argBuffer.getDescriptor(); m_cmd->cmdDrawIndexedIndirect( descriptor.buffer.buffer, descriptor.buffer.offset + offset, count, stride); - - this->finalizeDraw(); } m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); @@ -1516,7 +1506,7 @@ namespace dxvk { VkDeviceSize countOffset, uint32_t maxCount, uint32_t stride) { - if (this->commitGraphicsState()) { + if (this->commitGraphicsState()) { auto argDescriptor = m_state.id.argBuffer.getDescriptor(); auto cntDescriptor = m_state.id.cntBuffer.getDescriptor(); @@ -1526,8 +1516,6 @@ namespace dxvk { cntDescriptor.buffer.buffer, cntDescriptor.buffer.offset + countOffset, maxCount, stride); - - this->finalizeDraw(); } m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); @@ -1538,7 +1526,7 @@ namespace dxvk { const DxvkBufferSlice& counterBuffer, uint32_t counterDivisor, uint32_t counterBias) { - if (this->commitGraphicsState()) { + if (this->commitGraphicsState()) { auto physSlice = counterBuffer.getSliceHandle(); m_cmd->cmdDrawIndirectVertexCount(1, 0, @@ -1546,8 +1534,6 @@ namespace dxvk { physSlice.offset, counterBias, counterDivisor); - - this->finalizeDraw(); } m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); @@ -4355,7 +4341,7 @@ namespace dxvk { } - template + template bool DxvkContext::commitGraphicsState() { if (m_flags.test(DxvkContextFlag::GpDirtyPipeline)) { if (unlikely(!this->updateGraphicsPipeline())) @@ -4407,6 +4393,9 @@ namespace dxvk { if (m_flags.test(DxvkContextFlag::DirtyPushConstants)) this->updatePushConstants(); + if (m_flags.test(DxvkContextFlag::DirtyDrawBuffer) && Indirect) + this->trackDrawBuffer(); + return true; } @@ -4649,13 +4638,6 @@ namespace dxvk { } - template - void DxvkContext::finalizeDraw() { - if (m_flags.test(DxvkContextFlag::DirtyDrawBuffer) && Indirect) - this->trackDrawBuffer(); - } - - void DxvkContext::emitMemoryBarrier( VkDependencyFlags flags, VkPipelineStageFlags srcStages, diff --git a/src/dxvk/dxvk_context.h b/src/dxvk/dxvk_context.h index 07ecdf765..af4d2e602 100644 --- a/src/dxvk/dxvk_context.h +++ b/src/dxvk/dxvk_context.h @@ -1177,7 +1177,7 @@ namespace dxvk { bool commitComputeState(); - template + template bool commitGraphicsState(); void commitComputeInitBarriers(); @@ -1185,9 +1185,6 @@ namespace dxvk { void commitGraphicsBarriers(); - template - void finalizeDraw(); - void emitMemoryBarrier( VkDependencyFlags flags, VkPipelineStageFlags srcStages,