Add interpdebug

This commit is contained in:
Sally Coolatta 2022-03-29 20:51:58 -04:00 committed by Eidolon
parent 0503c853cc
commit c83d1be21f
6 changed files with 32 additions and 9 deletions

View file

@ -841,17 +841,12 @@ void D_SRB2Loop(void)
tictime = entertime;
}
dbg_entertime = entertime;
dbg_prevtime = prevtime;
dbg_tictime = tictime;
if (!(paused || P_AutoPause()))
{
#if 0
CONS_Printf("prevtime = %f\n", prevtime);
CONS_Printf("entertime = %f\n", entertime);
CONS_Printf("tictime = %f\n", tictime);
CONS_Printf("entertime - prevtime = %f\n", entertime - prevtime);
CONS_Printf("entertime - tictime = %f\n", entertime - tictime);
CONS_Printf("========\n");
#endif
if (entertime - prevtime >= 1.0f)
{
// Lagged for more frames than a gametic...

View file

@ -40,6 +40,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);
UINT32 R_GetFramerateCap(void)
{
if (rendermode == render_none)

View file

@ -20,6 +20,7 @@
#include "r_state.h"
extern consvar_t cv_fpscap;
extern consvar_t cv_interpdebug;
UINT32 R_GetFramerateCap(void);
boolean R_UsingFrameInterpolation(void);

View file

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

View file

@ -45,6 +45,8 @@
#include "lua_hud.h"
#include "lua_hook.h"
#include "r_fps.h"
UINT16 objectsdrawn = 0;
//
@ -621,6 +623,24 @@ 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))
@ -2755,6 +2775,8 @@ static void ST_overlayDrawer(void)
ST_drawInput();
ST_drawDebugInfo();
ST_DrawInterpDebug();
}
void ST_Drawer(void)

View file

@ -55,6 +55,8 @@ 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;