Skip to content

Commit

Permalink
[dxvk] Increment stat counters in command list rather than context
Browse files Browse the repository at this point in the history
Might change some numbers, but it's closer to reality.
  • Loading branch information
doitsujin committed Oct 28, 2024
1 parent 7cd8a14 commit c2928ab
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 27 deletions.
1 change: 0 additions & 1 deletion src/dxvk/dxvk_barrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,6 @@ namespace dxvk {
return;

list->cmdPipelineBarrier(m_cmdBuffer, &depInfo);
list->addStatCtr(DxvkStatCounter::CmdBarrierCount, 1u);

m_memoryBarrier.srcStageMask = 0u;
m_memoryBarrier.srcAccessMask = 0u;
Expand Down
18 changes: 18 additions & 0 deletions src/dxvk/dxvk_cmdlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ namespace dxvk {
void cmdBeginRendering(
const VkRenderingInfo* pRenderingInfo) {
m_cmd.execCommands = true;
m_statCounters.addCtr(DxvkStatCounter::CmdRenderPassCount, 1);

m_vkd->vkCmdBeginRendering(getCmdBuffer(), pRenderingInfo);
}
Expand Down Expand Up @@ -633,6 +634,7 @@ namespace dxvk {
uint32_t y,
uint32_t z) {
m_cmd.execCommands |= cmdBuffer == DxvkCmdBuffer::ExecBuffer;
m_statCounters.addCtr(DxvkStatCounter::CmdDispatchCalls, 1);

m_vkd->vkCmdDispatch(getCmdBuffer(cmdBuffer), x, y, z);
}
Expand All @@ -643,6 +645,7 @@ namespace dxvk {
VkBuffer buffer,
VkDeviceSize offset) {
m_cmd.execCommands |= cmdBuffer == DxvkCmdBuffer::ExecBuffer;
m_statCounters.addCtr(DxvkStatCounter::CmdDispatchCalls, 1);

m_vkd->vkCmdDispatchIndirect(getCmdBuffer(cmdBuffer), buffer, offset);
}
Expand All @@ -653,6 +656,8 @@ namespace dxvk {
uint32_t instanceCount,
uint32_t firstVertex,
uint32_t firstInstance) {
m_statCounters.addCtr(DxvkStatCounter::CmdDrawCalls, 1);

m_vkd->vkCmdDraw(getCmdBuffer(),
vertexCount, instanceCount,
firstVertex, firstInstance);
Expand All @@ -664,6 +669,8 @@ namespace dxvk {
VkDeviceSize offset,
uint32_t drawCount,
uint32_t stride) {
m_statCounters.addCtr(DxvkStatCounter::CmdDrawCalls, 1);

m_vkd->vkCmdDrawIndirect(getCmdBuffer(),
buffer, offset, drawCount, stride);
}
Expand All @@ -676,6 +683,8 @@ namespace dxvk {
VkDeviceSize countOffset,
uint32_t maxDrawCount,
uint32_t stride) {
m_statCounters.addCtr(DxvkStatCounter::CmdDrawCalls, 1);

m_vkd->vkCmdDrawIndirectCount(getCmdBuffer(),
buffer, offset, countBuffer, countOffset, maxDrawCount, stride);
}
Expand All @@ -687,6 +696,8 @@ namespace dxvk {
uint32_t firstIndex,
int32_t vertexOffset,
uint32_t firstInstance) {
m_statCounters.addCtr(DxvkStatCounter::CmdDrawCalls, 1);

m_vkd->vkCmdDrawIndexed(getCmdBuffer(),
indexCount, instanceCount,
firstIndex, vertexOffset,
Expand All @@ -699,6 +710,8 @@ namespace dxvk {
VkDeviceSize offset,
uint32_t drawCount,
uint32_t stride) {
m_statCounters.addCtr(DxvkStatCounter::CmdDrawCalls, 1);

m_vkd->vkCmdDrawIndexedIndirect(getCmdBuffer(),
buffer, offset, drawCount, stride);
}
Expand All @@ -711,6 +724,8 @@ namespace dxvk {
VkDeviceSize countOffset,
uint32_t maxDrawCount,
uint32_t stride) {
m_statCounters.addCtr(DxvkStatCounter::CmdDrawCalls, 1);

m_vkd->vkCmdDrawIndexedIndirectCount(getCmdBuffer(),
buffer, offset, countBuffer, countOffset, maxDrawCount, stride);
}
Expand All @@ -723,6 +738,8 @@ namespace dxvk {
VkDeviceSize counterBufferOffset,
uint32_t counterOffset,
uint32_t vertexStride) {
m_statCounters.addCtr(DxvkStatCounter::CmdDrawCalls, 1);

m_vkd->vkCmdDrawIndirectByteCountEXT(getCmdBuffer(),
instanceCount, firstInstance, counterBuffer,
counterBufferOffset, counterOffset, vertexStride);
Expand Down Expand Up @@ -777,6 +794,7 @@ namespace dxvk {
DxvkCmdBuffer cmdBuffer,
const VkDependencyInfo* dependencyInfo) {
m_cmd.execCommands |= cmdBuffer == DxvkCmdBuffer::ExecBuffer;
m_statCounters.addCtr(DxvkStatCounter::CmdBarrierCount, 1);

m_vkd->vkCmdPipelineBarrier2(getCmdBuffer(cmdBuffer), dependencyInfo);
}
Expand Down
26 changes: 0 additions & 26 deletions src/dxvk/dxvk_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,6 @@ namespace dxvk {
m_queryManager.endQueries(m_cmd,
VK_QUERY_TYPE_PIPELINE_STATISTICS);
}

m_cmd->addStatCtr(DxvkStatCounter::CmdDispatchCalls, 1);
}


Expand Down Expand Up @@ -864,8 +862,6 @@ namespace dxvk {

this->trackDrawBuffer();
}

m_cmd->addStatCtr(DxvkStatCounter::CmdDispatchCalls, 1);
}


Expand All @@ -879,8 +875,6 @@ namespace dxvk {
vertexCount, instanceCount,
firstVertex, firstInstance);
}

m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
}


Expand All @@ -896,8 +890,6 @@ namespace dxvk {
descriptor.buffer.offset + offset,
count, stride);
}

m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
}


Expand All @@ -917,8 +909,6 @@ namespace dxvk {
cntDescriptor.buffer.offset + countOffset,
maxCount, stride);
}

m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
}


Expand All @@ -934,8 +924,6 @@ namespace dxvk {
firstIndex, vertexOffset,
firstInstance);
}

m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
}


Expand All @@ -951,8 +939,6 @@ namespace dxvk {
descriptor.buffer.offset + offset,
count, stride);
}

m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
}


Expand All @@ -972,8 +958,6 @@ namespace dxvk {
cntDescriptor.buffer.offset + countOffset,
maxCount, stride);
}

m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
}


Expand All @@ -990,8 +974,6 @@ namespace dxvk {
counterBias,
counterDivisor);
}

m_cmd->addStatCtr(DxvkStatCounter::CmdDrawCalls, 1);
}


Expand Down Expand Up @@ -4749,8 +4731,6 @@ namespace dxvk {

for (uint32_t i = 0; i < framebufferInfo.numAttachments(); i++)
m_cmd->track(framebufferInfo.getAttachment(i).view->image(), DxvkAccess::Write);

m_cmd->addStatCtr(DxvkStatCounter::CmdRenderPassCount, 1);
}


Expand Down Expand Up @@ -6224,7 +6204,6 @@ namespace dxvk {
depInfo.pMemoryBarriers = &barrier;

m_cmd->cmdPipelineBarrier(DxvkCmdBuffer::ExecBuffer, &depInfo);
m_cmd->addStatCtr(DxvkStatCounter::CmdBarrierCount, 1);
}


Expand Down Expand Up @@ -6404,7 +6383,6 @@ namespace dxvk {
}

m_cmd->cmdPipelineBarrier(DxvkCmdBuffer::ExecBuffer, &depInfo);
m_cmd->addStatCtr(DxvkStatCounter::CmdBarrierCount, 1);

// Set up post-copy barriers
depInfo = { VK_STRUCTURE_TYPE_DEPENDENCY_INFO };
Expand Down Expand Up @@ -6547,7 +6525,6 @@ namespace dxvk {
}

m_cmd->cmdPipelineBarrier(DxvkCmdBuffer::ExecBuffer, &depInfo);
m_cmd->addStatCtr(DxvkStatCounter::CmdBarrierCount, 1);
}


Expand Down Expand Up @@ -6671,8 +6648,6 @@ namespace dxvk {
depInfo.pMemoryBarriers = &barrier;

m_cmd->cmdPipelineBarrier(DxvkCmdBuffer::InitBuffer, &depInfo);
m_cmd->addStatCtr(DxvkStatCounter::CmdBarrierCount, 1);

return m_zeroBuffer;
}

Expand Down Expand Up @@ -6772,7 +6747,6 @@ namespace dxvk {
depInfo.pImageMemoryBarriers = m_imageLayoutTransitions.data();

m_cmd->cmdPipelineBarrier(cmdBuffer, &depInfo);
m_cmd->addStatCtr(DxvkStatCounter::CmdBarrierCount, 1u);
} else {
// If we're recording into an out-of-order command buffer, batch
// layout transitions into a dedicated command buffer in order to
Expand Down

0 comments on commit c2928ab

Please sign in to comment.