From 3feec87d5214caad3b782fa9262495a98b3acdc5 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 7 Sep 2024 13:55:33 +0200 Subject: [PATCH] Count global number of drawcalls too --- irr/include/IVideoDriver.h | 2 ++ irr/src/CNullDriver.cpp | 2 ++ src/client/game.cpp | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/irr/include/IVideoDriver.h b/irr/include/IVideoDriver.h index b3312160c..af8d97fef 100644 --- a/irr/include/IVideoDriver.h +++ b/irr/include/IVideoDriver.h @@ -54,6 +54,8 @@ const c8 *const FogTypeNames[] = { }; struct SFrameStats { + //! Number of draw calls + u32 Drawcalls = 0; //! Count of primitives drawn u32 PrimitivesDrawn = 0; //! Number of hardware buffers uploaded (new or updated) diff --git a/irr/src/CNullDriver.cpp b/irr/src/CNullDriver.cpp index 6f261cef1..91f441a14 100644 --- a/irr/src/CNullDriver.cpp +++ b/irr/src/CNullDriver.cpp @@ -605,6 +605,7 @@ void CNullDriver::drawVertexPrimitiveList(const void *vertices, u32 vertexCount, { if ((iType == EIT_16BIT) && (vertexCount > 65536)) os::Printer::log("Too many vertices for 16bit index type, render artifacts may occur."); + FrameStats.Drawcalls++; FrameStats.PrimitivesDrawn += primitiveCount; } @@ -613,6 +614,7 @@ void CNullDriver::draw2DVertexPrimitiveList(const void *vertices, u32 vertexCoun { if ((iType == EIT_16BIT) && (vertexCount > 65536)) os::Printer::log("Too many vertices for 16bit index type, render artifacts may occur."); + FrameStats.Drawcalls++; FrameStats.PrimitivesDrawn += primitiveCount; } diff --git a/src/client/game.cpp b/src/client/game.cpp index 7213faafa..5855be96f 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -1953,7 +1953,10 @@ void Game::updateProfilers(const RunStats &stats, const FpsControl &draw_times, g_profiler->graphSet("FPS", 1.0f / dtime); auto stats2 = driver->getFrameStats(); - g_profiler->avg("Irr: primitives drawn", stats2.PrimitivesDrawn); + g_profiler->avg("Irr: drawcalls", stats2.Drawcalls); + if (stats2.Drawcalls > 0) + g_profiler->avg("Irr: primitives per drawcall", + stats2.PrimitivesDrawn / float(stats2.Drawcalls)); g_profiler->avg("Irr: buffers uploaded", stats2.HWBuffersUploaded); g_profiler->avg("Irr: buffers uploaded (bytes)", stats2.HWBuffersUploadedSize); }