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

[dxvk] Introduce finalizeDraw

May improve code gen by reducing function call overhead, in a
similar way as the duplicated checks in commitGraphicsState do.
This commit is contained in:
Philip Rebohle 2019-09-26 01:31:51 +02:00
parent 187748e4d3
commit 7cdc402a58
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 23 additions and 12 deletions

View File

@ -1465,7 +1465,7 @@ namespace dxvk {
vertexCount, instanceCount, vertexCount, instanceCount,
firstVertex, firstInstance); firstVertex, firstInstance);
this->commitGraphicsPostBarriers(); this->finalizeDraw<false>();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -1486,8 +1486,7 @@ namespace dxvk {
descriptor.buffer.offset + offset, descriptor.buffer.offset + offset,
count, stride); count, stride);
this->commitGraphicsPostBarriers(); this->finalizeDraw<true>();
this->trackDrawBuffer();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -1512,8 +1511,7 @@ namespace dxvk {
cntDescriptor.buffer.offset + countOffset, cntDescriptor.buffer.offset + countOffset,
maxCount, stride); maxCount, stride);
this->commitGraphicsPostBarriers(); this->finalizeDraw<true>();
this->trackDrawBuffer();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -1534,7 +1532,7 @@ namespace dxvk {
firstIndex, vertexOffset, firstIndex, vertexOffset,
firstInstance); firstInstance);
this->commitGraphicsPostBarriers(); this->finalizeDraw<false>();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -1555,8 +1553,7 @@ namespace dxvk {
descriptor.buffer.offset + offset, descriptor.buffer.offset + offset,
count, stride); count, stride);
this->commitGraphicsPostBarriers(); this->finalizeDraw<true>();
this->trackDrawBuffer();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -1581,8 +1578,7 @@ namespace dxvk {
cntDescriptor.buffer.offset + countOffset, cntDescriptor.buffer.offset + countOffset,
maxCount, stride); maxCount, stride);
this->commitGraphicsPostBarriers(); this->finalizeDraw<true>();
this->trackDrawBuffer();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -1604,7 +1600,7 @@ namespace dxvk {
counterBias, counterBias,
counterDivisor); counterDivisor);
this->commitGraphicsPostBarriers(); this->finalizeDraw<false>();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -4429,6 +4425,18 @@ namespace dxvk {
} }
template<bool Indirect>
void DxvkContext::finalizeDraw() {
if (m_flags.test(DxvkContextFlag::DirtyDrawBuffer) && Indirect)
this->trackDrawBuffer();
if (m_state.gp.flags.any(
DxvkGraphicsPipelineFlag::HasFsStorageDescriptors,
DxvkGraphicsPipelineFlag::HasVsStorageDescriptors))
this->commitGraphicsPostBarriers();
}
void DxvkContext::emitMemoryBarrier( void DxvkContext::emitMemoryBarrier(
VkPipelineStageFlags srcStages, VkPipelineStageFlags srcStages,
VkAccessFlags srcAccess, VkAccessFlags srcAccess,

View File

@ -1166,6 +1166,9 @@ namespace dxvk {
void commitGraphicsPostBarriers(); void commitGraphicsPostBarriers();
template<bool Indirect>
void finalizeDraw();
void emitMemoryBarrier( void emitMemoryBarrier(
VkPipelineStageFlags srcStages, VkPipelineStageFlags srcStages,
VkAccessFlags srcAccess, VkAccessFlags srcAccess,