Skip to content

Commit c409179

Browse files
Device Context: fixed primitive counters disregarding instance count
1 parent e8f8717 commit c409179

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Graphics/GraphicsEngine/include/DeviceContextBase.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,7 +2274,7 @@ inline void DeviceContextBase<ImplementationTraits>::Draw(const DrawAttribs& Att
22742274
if (m_pPipelineState)
22752275
{
22762276
const PRIMITIVE_TOPOLOGY Topology = m_pPipelineState->GetGraphicsPipelineDesc().PrimitiveTopology;
2277-
m_Stats.PrimitiveCounts[Topology] += GetPrimitiveCount(Topology, Attribs.NumVertices);
2277+
m_Stats.PrimitiveCounts[Topology] += GetPrimitiveCount(Topology, Attribs.NumVertices) * Attribs.NumInstances;
22782278
}
22792279
++m_Stats.CommandCounters.Draw;
22802280
}
@@ -2301,7 +2301,7 @@ inline void DeviceContextBase<ImplementationTraits>::DrawIndexed(const DrawIndex
23012301
if (m_pPipelineState)
23022302
{
23032303
const PRIMITIVE_TOPOLOGY Topology = m_pPipelineState->GetGraphicsPipelineDesc().PrimitiveTopology;
2304-
m_Stats.PrimitiveCounts[Topology] += GetPrimitiveCount(Topology, Attribs.NumIndices);
2304+
m_Stats.PrimitiveCounts[Topology] += GetPrimitiveCount(Topology, Attribs.NumIndices) * Attribs.NumInstances;
23052305
}
23062306
++m_Stats.CommandCounters.DrawIndexed;
23072307
}
@@ -2433,7 +2433,7 @@ inline void DeviceContextBase<ImplementationTraits>::MultiDraw(const MultiDrawAt
24332433
{
24342434
const PRIMITIVE_TOPOLOGY Topology = m_pPipelineState->GetGraphicsPipelineDesc().PrimitiveTopology;
24352435
for (Uint32 i = 0; i < Attribs.DrawCount; ++i)
2436-
m_Stats.PrimitiveCounts[Topology] += GetPrimitiveCount(Topology, Attribs.pDrawItems[i].NumVertices);
2436+
m_Stats.PrimitiveCounts[Topology] += GetPrimitiveCount(Topology, Attribs.pDrawItems[i].NumVertices) * Attribs.NumInstances;
24372437
}
24382438
if (m_NativeMultiDrawSupported)
24392439
++m_Stats.CommandCounters.MultiDraw;
@@ -2464,7 +2464,7 @@ inline void DeviceContextBase<ImplementationTraits>::MultiDrawIndexed(const Mult
24642464
{
24652465
const PRIMITIVE_TOPOLOGY Topology = m_pPipelineState->GetGraphicsPipelineDesc().PrimitiveTopology;
24662466
for (Uint32 i = 0; i < Attribs.DrawCount; ++i)
2467-
m_Stats.PrimitiveCounts[Topology] += GetPrimitiveCount(Topology, Attribs.pDrawItems[i].NumIndices);
2467+
m_Stats.PrimitiveCounts[Topology] += GetPrimitiveCount(Topology, Attribs.pDrawItems[i].NumIndices) * Attribs.NumInstances;
24682468
}
24692469
if (m_NativeMultiDrawSupported)
24702470
++m_Stats.CommandCounters.MultiDrawIndexed;

0 commit comments

Comments
 (0)