From 27378f3537e9dbe0bfeb1ebb8a653e6050f2ea4a Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sun, 8 Feb 2026 18:29:34 -0800 Subject: Implement basic perf counters --- include/swgfx.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/swgfx.h') diff --git a/include/swgfx.h b/include/swgfx.h index 9c3361d..72164b1 100644 --- a/include/swgfx.h +++ b/include/swgfx.h @@ -22,6 +22,8 @@ Multi-threading: #include #include +#define SWGFX_PROFILING 1 // TODO: Move this to client project cmake. + typedef float R; typedef struct sgVec2i { int x, y; } sgVec2i; @@ -66,6 +68,15 @@ typedef struct sgImage { typedef struct swgfx swgfx; +#if SWGFX_PROFILING +typedef struct sgCounters { + uint64_t frames; // Frames drawn. + uint64_t triangles3; // 3D triangles processed. + uint64_t triangles2; // 2D triangles processed. + uint64_t pixels; // Pixels written. +} sgCounters; +#endif // SWGFX_PROFILING + size_t sgMem(int width, int height); // Get memory requirements. swgfx* sgNew(int width, int height, void* mem); void sgDel(swgfx**); @@ -98,4 +109,6 @@ void sgTrianglesIndexedNonUniform(swgfx*, size_t numTris, const sgTriIdx* tris, void sgGamma (swgfx*, sgPixel*, int width, int height); void sgGammaInv(swgfx*, sgPixel*, int width, int height); +sgCounters sgGetCounters(const swgfx*); + void sgCheck(swgfx*); -- cgit v1.2.3