Put interpdebug stuff in perfstats instead

This commit is contained in:
Sally Coolatta 2022-04-27 18:59:54 -04:00 committed by Eidolon
parent c83d1be21f
commit f2a19b29d9
7 changed files with 29 additions and 30 deletions

View file

@ -841,9 +841,10 @@ void D_SRB2Loop(void)
tictime = entertime;
}
dbg_entertime = entertime;
dbg_prevtime = prevtime;
dbg_tictime = tictime;
// I looked at the possibility of putting in a float drawer for
// perfstats and it's very complicated, so we'll just do this instead...
ps_interp_frac.value.p = (precise_t)((entertime - tictime) * 1000.0f);
ps_interp_lag.value.p = (precise_t)((entertime - prevtime) * 1000.0f);
if (!(paused || P_AutoPause()))
{

View file

@ -17,6 +17,7 @@
#include "i_system.h"
#include "z_zone.h"
#include "p_local.h"
#include "r_fps.h"
#ifdef HWRENDER
#include "hardware/hw_main.h"
@ -122,6 +123,12 @@ perfstatrow_t commoncounter_rows[] = {
{0}
};
perfstatrow_t interpolation_rows[] = {
{"intpfrc", "Interp frac: ", &ps_interp_frac, PS_TIME},
{"intplag", "Interp lag: ", &ps_interp_lag, PS_TIME},
{0}
};
#ifdef HWRENDER
perfstatrow_t batchcount_rows[] = {
{"polygon", "Polygons: ", &ps_hw_numpolys, 0},
@ -473,6 +480,9 @@ static void PS_UpdateFrameStats(void)
if (PS_IsLevelActive())
PS_UpdateRowHistories(commoncounter_rows, true);
if (R_UsingFrameInterpolation())
PS_UpdateRowHistories(interpolation_rows, true);
#ifdef HWRENDER
if (rendermode == render_opengl && cv_glbatching.value)
{
@ -634,7 +644,7 @@ static void PS_DrawRenderStats(void)
{
const boolean hires = PS_HighResolution();
const int half_row = hires ? 5 : 4;
int x, y;
int x, y, cy = 10;
PS_DrawDescriptorHeader();
@ -645,7 +655,7 @@ static void PS_DrawRenderStats(void)
if (PS_IsLevelActive())
{
x = hires ? 115 : 90;
PS_DrawPerfRows(x, 10, V_BLUEMAP, commoncounter_rows);
cy = PS_DrawPerfRows(x, 10, V_BLUEMAP, commoncounter_rows) + half_row;
#ifdef HWRENDER
if (rendermode == render_opengl && cv_glbatching.value)
@ -659,6 +669,12 @@ static void PS_DrawRenderStats(void)
}
#endif
}
if (R_UsingFrameInterpolation())
{
x = hires ? 115 : 90;
PS_DrawPerfRows(x, cy, V_ROSYMAP, interpolation_rows);
}
}
static void PS_DrawGameLogicStats(void)

View file

@ -22,6 +22,7 @@
#include "r_state.h"
#include "z_zone.h"
#include "console.h" // con_startup_loadprogress
#include "m_perfstats.h" // ps_metric_t
#ifdef HWRENDER
#include "hardware/hw_main.h" // for cv_glshearing
#endif
@ -40,7 +41,8 @@ static CV_PossibleValue_t fpscap_cons_t[] = {
};
consvar_t cv_fpscap = CVAR_INIT ("fpscap", "Match refresh rate", CV_SAVE, fpscap_cons_t, NULL);
consvar_t cv_interpdebug = CVAR_INIT ("interpdebug", "Off", 0, CV_OnOff, NULL);
ps_metric_t ps_interp_frac = {0};
ps_metric_t ps_interp_lag = {0};
UINT32 R_GetFramerateCap(void)
{

View file

@ -18,9 +18,12 @@
#include "m_fixed.h"
#include "p_local.h"
#include "r_state.h"
#include "m_perfstats.h" // ps_metric_t
extern consvar_t cv_fpscap;
extern consvar_t cv_interpdebug;
extern ps_metric_t ps_interp_frac;
extern ps_metric_t ps_interp_lag;
UINT32 R_GetFramerateCap(void);
boolean R_UsingFrameInterpolation(void);

View file

@ -1625,5 +1625,4 @@ void R_RegisterEngineStuff(void)
// Frame interpolation/uncapped
CV_RegisterVar(&cv_fpscap);
CV_RegisterVar(&cv_interpdebug);
}

View file

@ -623,24 +623,6 @@ static void ST_drawDebugInfo(void)
#undef VFLAGS
}
float dbg_entertime = 0.0f, dbg_prevtime = 0.0f, dbg_tictime = 0.0f;
static void ST_DrawInterpDebug(void)
{
// TODO: when the devmode situation stops sucking eggs,
// remove cv_interpdebug and use DBG_RENDER instead.
if (!cv_interpdebug.value || !R_UsingFrameInterpolation())
{
return;
}
V_DrawRightAlignedString(312, 8, V_MONOSPACE, va("enter - tic: %.3f", dbg_entertime - dbg_tictime));
V_DrawRightAlignedString(312, 16, V_MONOSPACE, va("enter - prev: %.3f", dbg_entertime - dbg_prevtime));
V_DrawRightAlignedString(312, 24, V_MONOSPACE, va("tic: %.3f", dbg_tictime));
V_DrawRightAlignedString(312, 32, V_MONOSPACE, va("prev: %.3f", dbg_prevtime));
V_DrawRightAlignedString(312, 40, V_MONOSPACE, va("enter: %.3f", dbg_entertime));
}
static void ST_drawScore(void)
{
if (F_GetPromptHideHud(hudinfo[HUD_SCORE].y))
@ -2775,8 +2757,6 @@ static void ST_overlayDrawer(void)
ST_drawInput();
ST_drawDebugInfo();
ST_DrawInterpDebug();
}
void ST_Drawer(void)

View file

@ -55,8 +55,6 @@ void ST_preDrawTitleCard(void);
void ST_preLevelTitleCardDrawer(void);
void ST_drawWipeTitleCard(void);
extern float dbg_entertime, dbg_prevtime, dbg_tictime;
extern tic_t lt_ticker, lt_lasttic;
extern tic_t lt_exitticker, lt_endtime;