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 committed by NepDisk
parent ac2b3651ae
commit 86b8757aee
6 changed files with 49 additions and 4 deletions

View file

@ -131,6 +131,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"},
@ -1508,6 +1510,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

@ -109,6 +109,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

@ -328,6 +328,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

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

View file

@ -3059,4 +3059,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

@ -366,7 +366,12 @@ static INT32 SCR(INT32 r)
// Devmode information // Devmode information
/*static void ST_pushDebugString(INT32 *height, const char *string) static void ST_pushRow(INT32 *height)
{
*height -= 4;
}
static void ST_pushDebugString(INT32 *height, const char *string)
{ {
V_DrawRightAlignedString(320, *height, V_MONOSPACE, string); V_DrawRightAlignedString(320, *height, V_MONOSPACE, string);
*height -= 8; *height -= 8;
@ -418,9 +423,21 @@ static void ST_drawMusicDebug(INT32 *height)
} }
ST_pushDebugString(height, va(" Song: %8s", mname)); ST_pushDebugString(height, va(" Song: %8s", mname));
}*/ }
static void ST_drawDebugInfo(void) 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)
{ {
INT32 height = 192; INT32 height = 192;
@ -480,6 +497,16 @@ static void ST_drawDebugInfo(void)
height -= 32; height -= 32;
} }
/*if (cv_debug & DBG_MUSIC)
{
ST_drawMusicDebug(&height);
}*/
if (cv_debug & DBG_RENDER)
{
ST_drawRenderDebug(&height);
}
if (cv_debug & DBG_MEMORY) if (cv_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)));
} }