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_numpolyobjects = 0;
struct RenderStats g_renderstats;
static CV_PossibleValue_t drawdist_cons_t[] = {
/*{256, "256"},*/ {512, "512"}, {768, "768"},
{1024, "1024"}, {1536, "1536"}, {2048, "2048"},
@ -1508,6 +1510,8 @@ void R_RenderPlayerView(void)
framecount++;
validcount++;
memset(&g_renderstats, 0, sizeof g_renderstats);
// Clear buffers.
R_ClearPlanes();
if (viewmorph[viewssnum].use)

View file

@ -109,6 +109,15 @@ extern int ps_numsprites;
extern int ps_numdrawnodes;
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.
//

View file

@ -328,6 +328,9 @@ static visplane_t *new_visplane(unsigned hash)
}
check->next = visplanes[hash];
visplanes[hash] = check;
g_renderstats.visplanes++;
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++;
g_renderstats.drawsegs++;
}

View file

@ -366,7 +366,12 @@ static INT32 SCR(INT32 r)
// 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);
*height -= 8;
@ -418,9 +423,21 @@ static void ST_drawMusicDebug(INT32 *height)
}
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;
@ -480,6 +497,16 @@ static void ST_drawDebugInfo(void)
height -= 32;
}
/*if (cv_debug & DBG_MUSIC)
{
ST_drawMusicDebug(&height);
}*/
if (cv_debug & DBG_RENDER)
{
ST_drawRenderDebug(&height);
}
if (cv_debug & DBG_MEMORY)
V_DrawRightAlignedString(320, height, V_MONOSPACE, va("Heap used: %7sKB", sizeu1(Z_TagsUsage(0, INT32_MAX)>>10)));
}