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

[dxvk] Move finalizeDraw into commitGraphicsState

There is no readon to perform this after the draw anymore.
This commit is contained in:
Philip Rebohle 2019-10-26 03:25:11 +02:00
parent 4e3da45fde
commit 2b812f07c1
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 12 additions and 33 deletions

View File

@ -1419,12 +1419,10 @@ namespace dxvk {
uint32_t instanceCount, uint32_t instanceCount,
uint32_t firstVertex, uint32_t firstVertex,
uint32_t firstInstance) { uint32_t firstInstance) {
if (this->commitGraphicsState<false>()) { if (this->commitGraphicsState<false, false>()) {
m_cmd->cmdDraw( m_cmd->cmdDraw(
vertexCount, instanceCount, vertexCount, instanceCount,
firstVertex, firstInstance); firstVertex, firstInstance);
this->finalizeDraw<false>();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -1435,15 +1433,13 @@ namespace dxvk {
VkDeviceSize offset, VkDeviceSize offset,
uint32_t count, uint32_t count,
uint32_t stride) { uint32_t stride) {
if (this->commitGraphicsState<false>()) { if (this->commitGraphicsState<false, true>()) {
auto descriptor = m_state.id.argBuffer.getDescriptor(); auto descriptor = m_state.id.argBuffer.getDescriptor();
m_cmd->cmdDrawIndirect( m_cmd->cmdDrawIndirect(
descriptor.buffer.buffer, descriptor.buffer.buffer,
descriptor.buffer.offset + offset, descriptor.buffer.offset + offset,
count, stride); count, stride);
this->finalizeDraw<true>();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -1455,7 +1451,7 @@ namespace dxvk {
VkDeviceSize countOffset, VkDeviceSize countOffset,
uint32_t maxCount, uint32_t maxCount,
uint32_t stride) { uint32_t stride) {
if (this->commitGraphicsState<false>()) { if (this->commitGraphicsState<false, true>()) {
auto argDescriptor = m_state.id.argBuffer.getDescriptor(); auto argDescriptor = m_state.id.argBuffer.getDescriptor();
auto cntDescriptor = m_state.id.cntBuffer.getDescriptor(); auto cntDescriptor = m_state.id.cntBuffer.getDescriptor();
@ -1465,8 +1461,6 @@ namespace dxvk {
cntDescriptor.buffer.buffer, cntDescriptor.buffer.buffer,
cntDescriptor.buffer.offset + countOffset, cntDescriptor.buffer.offset + countOffset,
maxCount, stride); maxCount, stride);
this->finalizeDraw<true>();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -1479,13 +1473,11 @@ namespace dxvk {
uint32_t firstIndex, uint32_t firstIndex,
uint32_t vertexOffset, uint32_t vertexOffset,
uint32_t firstInstance) { uint32_t firstInstance) {
if (this->commitGraphicsState<true>()) { if (this->commitGraphicsState<true, false>()) {
m_cmd->cmdDrawIndexed( m_cmd->cmdDrawIndexed(
indexCount, instanceCount, indexCount, instanceCount,
firstIndex, vertexOffset, firstIndex, vertexOffset,
firstInstance); firstInstance);
this->finalizeDraw<false>();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -1496,15 +1488,13 @@ namespace dxvk {
VkDeviceSize offset, VkDeviceSize offset,
uint32_t count, uint32_t count,
uint32_t stride) { uint32_t stride) {
if (this->commitGraphicsState<true>()) { if (this->commitGraphicsState<true, true>()) {
auto descriptor = m_state.id.argBuffer.getDescriptor(); auto descriptor = m_state.id.argBuffer.getDescriptor();
m_cmd->cmdDrawIndexedIndirect( m_cmd->cmdDrawIndexedIndirect(
descriptor.buffer.buffer, descriptor.buffer.buffer,
descriptor.buffer.offset + offset, descriptor.buffer.offset + offset,
count, stride); count, stride);
this->finalizeDraw<true>();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -1516,7 +1506,7 @@ namespace dxvk {
VkDeviceSize countOffset, VkDeviceSize countOffset,
uint32_t maxCount, uint32_t maxCount,
uint32_t stride) { uint32_t stride) {
if (this->commitGraphicsState<true>()) { if (this->commitGraphicsState<true, true>()) {
auto argDescriptor = m_state.id.argBuffer.getDescriptor(); auto argDescriptor = m_state.id.argBuffer.getDescriptor();
auto cntDescriptor = m_state.id.cntBuffer.getDescriptor(); auto cntDescriptor = m_state.id.cntBuffer.getDescriptor();
@ -1526,8 +1516,6 @@ namespace dxvk {
cntDescriptor.buffer.buffer, cntDescriptor.buffer.buffer,
cntDescriptor.buffer.offset + countOffset, cntDescriptor.buffer.offset + countOffset,
maxCount, stride); maxCount, stride);
this->finalizeDraw<true>();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -1538,7 +1526,7 @@ namespace dxvk {
const DxvkBufferSlice& counterBuffer, const DxvkBufferSlice& counterBuffer,
uint32_t counterDivisor, uint32_t counterDivisor,
uint32_t counterBias) { uint32_t counterBias) {
if (this->commitGraphicsState<false>()) { if (this->commitGraphicsState<false, false>()) {
auto physSlice = counterBuffer.getSliceHandle(); auto physSlice = counterBuffer.getSliceHandle();
m_cmd->cmdDrawIndirectVertexCount(1, 0, m_cmd->cmdDrawIndirectVertexCount(1, 0,
@ -1546,8 +1534,6 @@ namespace dxvk {
physSlice.offset, physSlice.offset,
counterBias, counterBias,
counterDivisor); counterDivisor);
this->finalizeDraw<false>();
} }
m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1); m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
@ -4355,7 +4341,7 @@ namespace dxvk {
} }
template<bool Indexed> template<bool Indexed, bool Indirect>
bool DxvkContext::commitGraphicsState() { bool DxvkContext::commitGraphicsState() {
if (m_flags.test(DxvkContextFlag::GpDirtyPipeline)) { if (m_flags.test(DxvkContextFlag::GpDirtyPipeline)) {
if (unlikely(!this->updateGraphicsPipeline())) if (unlikely(!this->updateGraphicsPipeline()))
@ -4407,6 +4393,9 @@ namespace dxvk {
if (m_flags.test(DxvkContextFlag::DirtyPushConstants)) if (m_flags.test(DxvkContextFlag::DirtyPushConstants))
this->updatePushConstants<VK_PIPELINE_BIND_POINT_GRAPHICS>(); this->updatePushConstants<VK_PIPELINE_BIND_POINT_GRAPHICS>();
if (m_flags.test(DxvkContextFlag::DirtyDrawBuffer) && Indirect)
this->trackDrawBuffer();
return true; return true;
} }
@ -4649,13 +4638,6 @@ namespace dxvk {
} }
template<bool Indirect>
void DxvkContext::finalizeDraw() {
if (m_flags.test(DxvkContextFlag::DirtyDrawBuffer) && Indirect)
this->trackDrawBuffer();
}
void DxvkContext::emitMemoryBarrier( void DxvkContext::emitMemoryBarrier(
VkDependencyFlags flags, VkDependencyFlags flags,
VkPipelineStageFlags srcStages, VkPipelineStageFlags srcStages,

View File

@ -1177,7 +1177,7 @@ namespace dxvk {
bool commitComputeState(); bool commitComputeState();
template<bool Indexed> template<bool Indexed, bool Indirect>
bool commitGraphicsState(); bool commitGraphicsState();
void commitComputeInitBarriers(); void commitComputeInitBarriers();
@ -1185,9 +1185,6 @@ namespace dxvk {
void commitGraphicsBarriers(); void commitGraphicsBarriers();
template<bool Indirect>
void finalizeDraw();
void emitMemoryBarrier( void emitMemoryBarrier(
VkDependencyFlags flags, VkDependencyFlags flags,
VkPipelineStageFlags srcStages, VkPipelineStageFlags srcStages,