Count global number of drawcalls too

This commit is contained in:
sfan5 2024-09-07 13:55:33 +02:00
parent 275bef0633
commit 3feec87d52
3 changed files with 8 additions and 1 deletions

@ -54,6 +54,8 @@ const c8 *const FogTypeNames[] = {
}; };
struct SFrameStats { struct SFrameStats {
//! Number of draw calls
u32 Drawcalls = 0;
//! Count of primitives drawn //! Count of primitives drawn
u32 PrimitivesDrawn = 0; u32 PrimitivesDrawn = 0;
//! Number of hardware buffers uploaded (new or updated) //! Number of hardware buffers uploaded (new or updated)

@ -605,6 +605,7 @@ void CNullDriver::drawVertexPrimitiveList(const void *vertices, u32 vertexCount,
{ {
if ((iType == EIT_16BIT) && (vertexCount > 65536)) if ((iType == EIT_16BIT) && (vertexCount > 65536))
os::Printer::log("Too many vertices for 16bit index type, render artifacts may occur."); os::Printer::log("Too many vertices for 16bit index type, render artifacts may occur.");
FrameStats.Drawcalls++;
FrameStats.PrimitivesDrawn += primitiveCount; FrameStats.PrimitivesDrawn += primitiveCount;
} }
@ -613,6 +614,7 @@ void CNullDriver::draw2DVertexPrimitiveList(const void *vertices, u32 vertexCoun
{ {
if ((iType == EIT_16BIT) && (vertexCount > 65536)) if ((iType == EIT_16BIT) && (vertexCount > 65536))
os::Printer::log("Too many vertices for 16bit index type, render artifacts may occur."); os::Printer::log("Too many vertices for 16bit index type, render artifacts may occur.");
FrameStats.Drawcalls++;
FrameStats.PrimitivesDrawn += primitiveCount; FrameStats.PrimitivesDrawn += primitiveCount;
} }

@ -1953,7 +1953,10 @@ void Game::updateProfilers(const RunStats &stats, const FpsControl &draw_times,
g_profiler->graphSet("FPS", 1.0f / dtime); g_profiler->graphSet("FPS", 1.0f / dtime);
auto stats2 = driver->getFrameStats(); 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", stats2.HWBuffersUploaded);
g_profiler->avg("Irr: buffers uploaded (bytes)", stats2.HWBuffersUploadedSize); g_profiler->avg("Irr: buffers uploaded (bytes)", stats2.HWBuffersUploadedSize);
} }