devmode render: display skybox portal, visplane and drawseg counts on HUD

- Skybox portal count moved from console print to HUD
- Displays visplane count and drawseg count
This commit is contained in:
James R 2023-04-08 00:37:58 -07:00
parent 21a31c7a51
commit 39ea73a4ad
6 changed files with 36 additions and 1 deletions

View file

@ -126,6 +126,8 @@ int ps_numsprites = 0;
int ps_numdrawnodes = 0; int ps_numdrawnodes = 0;
int ps_numpolyobjects = 0; int ps_numpolyobjects = 0;
struct RenderStats g_renderstats;
static CV_PossibleValue_t drawdist_cons_t[] = { static CV_PossibleValue_t drawdist_cons_t[] = {
/*{256, "256"},*/ {512, "512"}, {768, "768"}, /*{256, "256"},*/ {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"}, {1024, "1024"}, {1536, "1536"}, {2048, "2048"},
@ -1525,6 +1527,8 @@ void R_RenderPlayerView(void)
framecount++; framecount++;
validcount++; validcount++;
memset(&g_renderstats, 0, sizeof g_renderstats);
// Clear buffers. // Clear buffers.
R_ClearPlanes(); R_ClearPlanes();
if (viewmorph[viewssnum].use) if (viewmorph[viewssnum].use)

View file

@ -106,6 +106,15 @@ extern int ps_numsprites;
extern int ps_numdrawnodes; extern int ps_numdrawnodes;
extern int ps_numpolyobjects; extern int ps_numpolyobjects;
struct RenderStats
{
size_t visplanes;
size_t drawsegs;
size_t skybox_portals;
};
extern struct RenderStats g_renderstats;
// //
// REFRESH - the actual rendering functions. // REFRESH - the actual rendering functions.
// //

View file

@ -341,6 +341,9 @@ static visplane_t *new_visplane(unsigned hash)
} }
check->next = visplanes[hash]; check->next = visplanes[hash];
visplanes[hash] = check; visplanes[hash] = check;
g_renderstats.visplanes++;
return check; return check;
} }

View file

@ -312,5 +312,5 @@ void Portal_AddSkyboxPortals (const player_t *player)
} }
} }
CONS_Debug(DBG_RENDER, "Skybox portals: %d\n", count); g_renderstats.skybox_portals = count;
} }

View file

@ -3024,4 +3024,6 @@ void R_StoreWallRange(INT32 start, INT32 stop)
ds_p->bsilheight = twosidedmidtexture ? INT32_MAX: INT32_MIN; ds_p->bsilheight = twosidedmidtexture ? INT32_MAX: INT32_MIN;
} }
ds_p++; ds_p++;
g_renderstats.drawsegs++;
} }

View file

@ -434,6 +434,18 @@ static void ST_drawMusicDebug(INT32 *height)
} }
} }
static void ST_drawRenderDebug(INT32 *height)
{
const struct RenderStats *i = &g_renderstats;
ST_pushDebugString(height, va(" Visplanes: %4s", sizeu1(i->visplanes)));
ST_pushDebugString(height, va(" Drawsegs: %4s", sizeu1(i->drawsegs)));
ST_pushRow(height);
ST_pushDebugString(height, va("Skybox Portals: %4s", sizeu1(i->skybox_portals)));
}
void ST_drawDebugInfo(void) void ST_drawDebugInfo(void)
{ {
INT32 height = 192; INT32 height = 192;
@ -516,6 +528,11 @@ void ST_drawDebugInfo(void)
ST_drawMusicDebug(&height); ST_drawMusicDebug(&height);
} }
if (cht_debug & DBG_RENDER)
{
ST_drawRenderDebug(&height);
}
if (cht_debug & DBG_MEMORY) if (cht_debug & DBG_MEMORY)
V_DrawRightAlignedString(320, height, V_MONOSPACE, va("Heap used: %7sKB", sizeu1(Z_TagsUsage(0, INT32_MAX)>>10))); V_DrawRightAlignedString(320, height, V_MONOSPACE, va("Heap used: %7sKB", sizeu1(Z_TagsUsage(0, INT32_MAX)>>10)));
} }