mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-12-23 16:32:36 +00:00
Calculate FPS stuff even if frame is skipped
I decided ultimately to actually keep the frame skip optimization disabled, because I think it is actually a little bit helpful that you can still get accurate rendering perfstats while paused, however if we decide otherwise then we can have this optimization back without making the game act like it's lagging.
This commit is contained in:
parent
821fd41d70
commit
33f316ded2
2 changed files with 19 additions and 25 deletions
25
src/screen.c
25
src/screen.c
|
|
@ -522,6 +522,7 @@ boolean SCR_IsAspectCorrect(INT32 width, INT32 height)
|
||||||
// moved out of os-specific code for consistency
|
// moved out of os-specific code for consistency
|
||||||
static boolean ticsgraph[TICRATE];
|
static boolean ticsgraph[TICRATE];
|
||||||
static tic_t lasttic;
|
static tic_t lasttic;
|
||||||
|
static tic_t totaltics;
|
||||||
|
|
||||||
static UINT32 fpstime = 0;
|
static UINT32 fpstime = 0;
|
||||||
static UINT32 lastupdatetime = 0;
|
static UINT32 lastupdatetime = 0;
|
||||||
|
|
@ -537,6 +538,11 @@ double aproxfps = 0.0f;
|
||||||
void SCR_CalcAproxFps(void)
|
void SCR_CalcAproxFps(void)
|
||||||
{
|
{
|
||||||
tic_t i = 0;
|
tic_t i = 0;
|
||||||
|
tic_t ontic = I_GetTime();
|
||||||
|
|
||||||
|
totaltics = 0;
|
||||||
|
|
||||||
|
// Update FPS time
|
||||||
if (I_PreciseToMicros(fpstime - lastupdatetime) > 1000000 * FPSUPDATERATE)
|
if (I_PreciseToMicros(fpstime - lastupdatetime) > 1000000 * FPSUPDATERATE)
|
||||||
{
|
{
|
||||||
if (fpssampleslen == FPSMAXSAMPLES)
|
if (fpssampleslen == FPSMAXSAMPLES)
|
||||||
|
|
@ -558,15 +564,8 @@ void SCR_CalcAproxFps(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
fpstime = I_GetPreciseTime();
|
fpstime = I_GetPreciseTime();
|
||||||
}
|
|
||||||
|
|
||||||
void SCR_DisplayTicRate(void)
|
|
||||||
{
|
|
||||||
tic_t i;
|
|
||||||
tic_t ontic = I_GetTime();
|
|
||||||
tic_t totaltics = 0;
|
|
||||||
const UINT8 *ticcntcolor = NULL;
|
|
||||||
|
|
||||||
|
// Update ticrate time
|
||||||
for (i = lasttic + 1; i < TICRATE+lasttic && i < ontic; ++i)
|
for (i = lasttic + 1; i < TICRATE+lasttic && i < ontic; ++i)
|
||||||
ticsgraph[i % TICRATE] = false;
|
ticsgraph[i % TICRATE] = false;
|
||||||
|
|
||||||
|
|
@ -576,6 +575,13 @@ void SCR_DisplayTicRate(void)
|
||||||
if (ticsgraph[i])
|
if (ticsgraph[i])
|
||||||
++totaltics;
|
++totaltics;
|
||||||
|
|
||||||
|
lasttic = ontic;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SCR_DisplayTicRate(void)
|
||||||
|
{
|
||||||
|
const UINT8 *ticcntcolor = NULL;
|
||||||
|
|
||||||
// draw "FPS"
|
// draw "FPS"
|
||||||
V_DrawFixedPatch(306<<FRACBITS, 183<<FRACBITS, FRACUNIT, V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS, framecounter, R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_YELLOW, GTC_CACHE));
|
V_DrawFixedPatch(306<<FRACBITS, 183<<FRACBITS, FRACUNIT, V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS, framecounter, R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_YELLOW, GTC_CACHE));
|
||||||
|
|
||||||
|
|
@ -613,9 +619,6 @@ void SCR_DisplayTicRate(void)
|
||||||
// draw our actual framerate
|
// draw our actual framerate
|
||||||
V_DrawPingNum(306, 190, V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS, totaltics, ticcntcolor);
|
V_DrawPingNum(306, 190, V_SNAPTOBOTTOM|V_SNAPTORIGHT|V_HUDTRANS, totaltics, ticcntcolor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lasttic = ontic;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SCR_DisplayLocalPing
|
// SCR_DisplayLocalPing
|
||||||
|
|
|
||||||
|
|
@ -1256,11 +1256,10 @@ void I_UpdateNoBlit(void)
|
||||||
// from PrBoom's src/SDL/i_video.c
|
// from PrBoom's src/SDL/i_video.c
|
||||||
static inline boolean I_SkipFrame(void)
|
static inline boolean I_SkipFrame(void)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 1
|
||||||
static boolean skip = false;
|
|
||||||
|
|
||||||
if (rendermode != render_soft)
|
|
||||||
return false;
|
return false;
|
||||||
|
#else
|
||||||
|
static boolean skip = false;
|
||||||
|
|
||||||
skip = !skip;
|
skip = !skip;
|
||||||
|
|
||||||
|
|
@ -1276,7 +1275,6 @@ static inline boolean I_SkipFrame(void)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
@ -1289,11 +1287,11 @@ void I_FinishUpdate(void)
|
||||||
if (rendermode == render_none)
|
if (rendermode == render_none)
|
||||||
return; //Alam: No software or OpenGl surface
|
return; //Alam: No software or OpenGl surface
|
||||||
|
|
||||||
|
SCR_CalcAproxFps();
|
||||||
|
|
||||||
if (I_SkipFrame())
|
if (I_SkipFrame())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SCR_CalcAproxFps();
|
|
||||||
|
|
||||||
if (st_overlay)
|
if (st_overlay)
|
||||||
{
|
{
|
||||||
if (cv_ticrate.value)
|
if (cv_ticrate.value)
|
||||||
|
|
@ -1338,13 +1336,6 @@ void I_FinishUpdate(void)
|
||||||
|
|
||||||
if (rendermode == render_soft && screens[0])
|
if (rendermode == render_soft && screens[0])
|
||||||
{
|
{
|
||||||
SDL_Rect rect;
|
|
||||||
|
|
||||||
rect.x = 0;
|
|
||||||
rect.y = 0;
|
|
||||||
rect.w = vid.width;
|
|
||||||
rect.h = vid.height;
|
|
||||||
|
|
||||||
if (!bufSurface) //Double-Check
|
if (!bufSurface) //Double-Check
|
||||||
{
|
{
|
||||||
Impl_VideoSetupSDLBuffer();
|
Impl_VideoSetupSDLBuffer();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue