diff --git a/src/graphics/Stats.cpp b/src/graphics/Stats.cpp index 055485cef8..bac67ca22c 100644 --- a/src/graphics/Stats.cpp +++ b/src/graphics/Stats.cpp @@ -16,6 +16,8 @@ namespace Graphics { m_counterRefs = { GetOrCreateCounter("DrawMesh Calls"), + GetOrCreateCounter("DrawMesh Instance Calls"), + GetOrCreateCounter("DrawMesh Instanced Calls"), GetOrCreateCounter("Num Points Drawn"), GetOrCreateCounter("Num Lines Drawn"), GetOrCreateCounter("Num Tris Drawn"), diff --git a/src/graphics/Stats.h b/src/graphics/Stats.h index f8b856c4b3..5a4b49dfd0 100644 --- a/src/graphics/Stats.h +++ b/src/graphics/Stats.h @@ -22,6 +22,8 @@ namespace Graphics { enum StatType { // renderer entries STAT_DRAWCALL = 0, + STAT_DRAWCALLINSTANCES, + STAT_DRAWCALLSINSTANCED, STAT_NUM_POINTS, STAT_NUM_LINES, STAT_NUM_TRIS, diff --git a/src/graphics/opengl/RendererGL.cpp b/src/graphics/opengl/RendererGL.cpp index f175da389a..46fe04f11a 100644 --- a/src/graphics/opengl/RendererGL.cpp +++ b/src/graphics/opengl/RendererGL.cpp @@ -976,7 +976,8 @@ namespace Graphics { inst->Release(); CheckRenderErrors(__FUNCTION__, __LINE__); - m_stats.AddToStatCount(Stats::STAT_DRAWCALL, 1); + m_stats.AddToStatCount(Stats::STAT_DRAWCALLINSTANCES, 1); + m_stats.AddToStatCount(Stats::STAT_DRAWCALLSINSTANCED, inst->GetInstanceCount()); stat_primitives(m_stats, type, numElems); return true; } diff --git a/src/pigui/PerfInfo.cpp b/src/pigui/PerfInfo.cpp index de2fbcc51b..8edd7ef1a5 100644 --- a/src/pigui/PerfInfo.cpp +++ b/src/pigui/PerfInfo.cpp @@ -399,6 +399,8 @@ void PerfInfo::DrawRendererStats() { const Graphics::Stats::TFrameData &stats = Pi::renderer->GetStats().FrameStatsPrevious(); const Uint32 numDrawCalls = stats.m_stats[Graphics::Stats::STAT_DRAWCALL]; + const Uint32 numDrawCallInstances = stats.m_stats[Graphics::Stats::STAT_DRAWCALLINSTANCES]; + const Uint32 numDrawCallsInstanced = stats.m_stats[Graphics::Stats::STAT_DRAWCALLSINSTANCED]; const Uint32 numTris = stats.m_stats[Graphics::Stats::STAT_NUM_TRIS]; const Uint32 numLines = stats.m_stats[Graphics::Stats::STAT_NUM_LINES]; const Uint32 numPoints = stats.m_stats[Graphics::Stats::STAT_NUM_POINTS]; @@ -433,8 +435,8 @@ void PerfInfo::DrawRendererStats() const Uint32 cachedTextureMemUsage = tex2dMemUsage + texCubeMemUsage + texArray2dMemUsage; ImGui::SeparatorText("Renderer"); - ImGui::Text("%u Draw calls, %u CommandList flushes", - numDrawCalls, numCmdListFlushes); + ImGui::Text("%u Draw calls, %u | %u Instanced calls, %u CommandList flushes", + numDrawCalls, numDrawCallInstances, numDrawCallsInstanced, numCmdListFlushes); ImGui::Indent(); ImGui::Text("%u points", numPoints);