mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- reworked the FPS display to use ZDoom's fstat class to get rid of the microscopic font it used.
- changed time display for rendering to exclude VSync and playsim times to get more meaningful information.
This commit is contained in:
parent
cae710bd59
commit
a1a9770b44
18 changed files with 75 additions and 169 deletions
|
@ -1422,7 +1422,7 @@ RESTART:
|
|||
if (bDraw)
|
||||
{
|
||||
viewDrawScreen();
|
||||
g_gameUpdateAndDrawTime = timerGetHiTicks() - gameUpdateStartTime;
|
||||
g_gameUpdateAndDrawTime = g_beforeSwapTime/* timerGetHiTicks()*/ - gameUpdateStartTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ struct GameInterface : ::GameInterface
|
|||
void set_hud_layout(int size) override;
|
||||
void set_hud_scale(int size) override;
|
||||
bool mouseInactiveConditional(bool condition) override;
|
||||
FString statFPS() override;
|
||||
};
|
||||
|
||||
END_BLD_NS
|
||||
|
|
|
@ -60,6 +60,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include "view.h"
|
||||
#include "warp.h"
|
||||
#include "weapon.h"
|
||||
#include "zstring.h"
|
||||
|
||||
CVARD(Bool, hud_powerupduration, true, CVAR_ARCHIVE|CVAR_FRONTEND_BLOOD, "enable/disable displaying the remaining seconds for power-ups")
|
||||
|
||||
|
@ -3569,7 +3570,6 @@ RORHACK:
|
|||
#endif
|
||||
viewDrawMapTitle();
|
||||
viewDrawAimedPlayerName();
|
||||
viewPrintFPS();
|
||||
if (gPaused)
|
||||
{
|
||||
viewDrawText(1, "PAUSED", 160, 10, 0, 0, 1, 0);
|
||||
|
@ -3740,9 +3740,9 @@ void viewResetCrosshairToDefault(void)
|
|||
|
||||
#define FPS_COLOR(x) ((x) ? COLOR_RED : COLOR_WHITE)
|
||||
|
||||
void viewPrintFPS(void)
|
||||
FString GameInterface::statFPS(void)
|
||||
{
|
||||
char tempbuf[128];
|
||||
FString output;
|
||||
static int32_t frameCount;
|
||||
static double cumulativeFrameDelay;
|
||||
static double lastFrameTime;
|
||||
|
@ -3757,73 +3757,35 @@ void viewPrintFPS(void)
|
|||
{
|
||||
int32_t x = (xdim <= 640);
|
||||
|
||||
if (r_showfps)
|
||||
//if (r_showfps)
|
||||
{
|
||||
int32_t chars = Bsprintf(tempbuf, "%.1f ms, %5.1f fps", frameDelay, lastFPS);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+1+FPS_YOFFSET,
|
||||
FPS_COLOR(lastFPS < LOW_FPS), -1, tempbuf, x);
|
||||
output.AppendFormat("%.1f ms, %5.1f fps\n", frameDelay, lastFPS);
|
||||
|
||||
if (r_showfps > 1)
|
||||
{
|
||||
chars = Bsprintf(tempbuf, "max: %5.1f fps", maxFPS);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+10+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+10+FPS_YOFFSET,
|
||||
FPS_COLOR(maxFPS < LOW_FPS), -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "min: %5.1f fps", minFPS);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+20+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+20+FPS_YOFFSET,
|
||||
FPS_COLOR(minFPS < LOW_FPS), -1, tempbuf, x);
|
||||
output.AppendFormat("max: %5.1f fps\n", maxFPS);
|
||||
output.AppendFormat("min: %5.1f fps\n", minFPS);
|
||||
}
|
||||
if (r_showfps > 2)
|
||||
{
|
||||
if (g_gameUpdateTime > maxGameUpdate) maxGameUpdate = g_gameUpdateTime;
|
||||
if (g_gameUpdateTime < minGameUpdate) minGameUpdate = g_gameUpdateTime;
|
||||
|
||||
chars = Bsprintf(tempbuf, "Game Update: %2.2f ms + draw: %2.2f ms", g_gameUpdateTime, g_gameUpdateAndDrawTime);
|
||||
output.AppendFormat("Game Update: %2.2f ms + draw: %2.2f ms\n", g_gameUpdateTime, g_gameUpdateAndDrawTime - g_gameUpdateTime);
|
||||
output.AppendFormat("GU min/max/avg: %5.2f/%5.2f/%5.2f ms\n", minGameUpdate, maxGameUpdate, g_gameUpdateAvgTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+30+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+30+FPS_YOFFSET,
|
||||
FPS_COLOR(g_gameUpdateAndDrawTime >= SLOW_FRAME_TIME), -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "GU min/max/avg: %5.2f/%5.2f/%5.2f ms", minGameUpdate, maxGameUpdate, g_gameUpdateAvgTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+40+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+40+FPS_YOFFSET,
|
||||
FPS_COLOR(maxGameUpdate >= SLOW_FRAME_TIME), -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "bufferjitter: %i", gBufferJitter);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+50+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+50+FPS_YOFFSET,
|
||||
COLOR_WHITE, -1, tempbuf, x);
|
||||
output.AppendFormat("bufferjitter: %i\n", gBufferJitter);
|
||||
#if 0
|
||||
chars = Bsprintf(tempbuf, "G_MoveActors(): %.3e ms", g_moveActorsTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+50+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+50+FPS_YOFFSET,
|
||||
COLOR_WHITE, -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "G_MoveWorld(): %.3e ms", g_moveWorldTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+60+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+60+FPS_YOFFSET,
|
||||
COLOR_WHITE, -1, tempbuf, x);
|
||||
output.AppendFormat("G_MoveActors(): %.3f ms\n", g_moveActorsTime);
|
||||
output.AppendFormat("G_MoveWorld(): %.3f ms\n", g_moveWorldTime);
|
||||
#endif
|
||||
}
|
||||
#if 0
|
||||
// lag meter
|
||||
if (g_netClientPeer)
|
||||
{
|
||||
chars = Bsprintf(tempbuf, "%d +- %d ms", (g_netClientPeer->lastRoundTripTime + g_netClientPeer->roundTripTime)/2,
|
||||
output.AppendFormat("%d +- %d ms\n", (g_netClientPeer->lastRoundTripTime + g_netClientPeer->roundTripTime)/2,
|
||||
(g_netClientPeer->lastRoundTripTimeVariance + g_netClientPeer->roundTripTimeVariance)/2);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+30+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+30+1+FPS_YOFFSET, FPS_COLOR(g_netClientPeer->lastRoundTripTime > 200), -1, tempbuf, x);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -3855,6 +3817,7 @@ void viewPrintFPS(void)
|
|||
frameCount++;
|
||||
}
|
||||
lastFrameTime = frameTime;
|
||||
return output;
|
||||
}
|
||||
|
||||
#undef FPS_COLOR
|
||||
|
|
|
@ -151,7 +151,6 @@ void viewUpdateDelirium(void);
|
|||
void viewUpdateShake(void);
|
||||
void viewSetCrosshairColor(int32_t r, int32_t g, int32_t b);
|
||||
void viewResetCrosshairToDefault(void);
|
||||
void viewPrintFPS(void);
|
||||
void viewSetSystemMessage(const char* pMessage, ...);
|
||||
|
||||
inline void viewInterpolateSector(int nSector, sectortype *pSector)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "c_cvars.h"
|
||||
#include "inputstate.h"
|
||||
#include "printf.h"
|
||||
#include "zstring.h"
|
||||
|
||||
|
||||
#ifdef DEBUGGINGAIDS
|
||||
|
@ -170,9 +171,12 @@ struct GameInterface
|
|||
virtual void set_hud_layout(int size) = 0;
|
||||
virtual void set_hud_scale(int size) = 0;
|
||||
virtual bool mouseInactiveConditional(bool condition) { return condition; }
|
||||
virtual FString statFPS() { return "FPS display not available"; }
|
||||
};
|
||||
|
||||
extern GameInterface* gi;
|
||||
extern double g_beforeSwapTime;
|
||||
|
||||
|
||||
void ImGui_Begin_Frame();
|
||||
|
||||
|
|
|
@ -10230,6 +10230,8 @@ void videoNextPage(void)
|
|||
}
|
||||
videoEndDrawing(); //}}}
|
||||
|
||||
g_beforeSwapTime = timerGetHiTicks();
|
||||
|
||||
// Draw the ImGui menu on top of the game content, but below the console (if open.)
|
||||
if (GUICapture & 6)
|
||||
{
|
||||
|
|
|
@ -70,6 +70,7 @@ CVAR(Int, windowy, -1, CVAR_ARCHIVE | CVAR_VIDEOCONFIG)
|
|||
static SDL_version linked;
|
||||
#endif
|
||||
|
||||
double g_beforeSwapTime;
|
||||
GameInterface* gi;
|
||||
FArgs* Args;
|
||||
|
||||
|
@ -1536,16 +1537,7 @@ void videoShowFrame(int32_t w)
|
|||
}
|
||||
|
||||
static uint32_t lastSwapTime = 0;
|
||||
#ifdef TIMING
|
||||
cycle_t clock;
|
||||
clock.Reset();
|
||||
clock.Clock();
|
||||
#endif
|
||||
glFinish();
|
||||
#ifdef TIMING
|
||||
clock.Unclock();
|
||||
OSD_Printf("glfinish time: %2.3f\n", clock.TimeMS());
|
||||
#endif
|
||||
SDL_GL_SwapWindow(sdl_window);
|
||||
|
||||
lastSwapTime = SDL_GetTicks();
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "gamecontrol.h"
|
||||
#include "m_argv.h"
|
||||
#include "rts.h"
|
||||
#include "stats.h"
|
||||
|
||||
/* Notes
|
||||
|
||||
|
@ -337,9 +338,15 @@ CUSTOM_CVARD(Int, r_drawweapon, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG, "enable/disab
|
|||
if (self < 0 || self > 2) self = 1;
|
||||
}
|
||||
|
||||
ADD_STAT(fps)
|
||||
{
|
||||
return gi->statFPS();
|
||||
}
|
||||
|
||||
CUSTOM_CVARD(Int, r_showfps, 0, 0, "show the frame rate counter")
|
||||
{
|
||||
if (self < 0 || self > 3) self = 1;
|
||||
FStat::EnableStat("fps", self != 0);
|
||||
}
|
||||
|
||||
CUSTOM_CVARD(Int, r_showfpsperiod, 0, 0, "time in seconds before averaging min and max stats for r_showfps 2+")
|
||||
|
|
|
@ -80,6 +80,15 @@ void FStat::ToggleStat (const char *name)
|
|||
Printf ("Unknown stat: %s\n", name);
|
||||
}
|
||||
|
||||
void FStat::EnableStat(const char* name, bool on)
|
||||
{
|
||||
FStat* stat = FindStat(name);
|
||||
if (stat)
|
||||
stat->m_Active = on;
|
||||
else
|
||||
Printf("Unknown stat: %s\n", name);
|
||||
}
|
||||
|
||||
void FStat::ToggleStat ()
|
||||
{
|
||||
m_Active = !m_Active;
|
||||
|
|
|
@ -226,6 +226,7 @@ public:
|
|||
static void PrintStat ();
|
||||
static FStat *FindStat (const char *name);
|
||||
static void ToggleStat (const char *name);
|
||||
static void EnableStat(const char* name, bool on);
|
||||
static void DumpRegisteredStats ();
|
||||
|
||||
private:
|
||||
|
|
|
@ -666,10 +666,7 @@ void G_DoCheats(void)
|
|||
return;
|
||||
|
||||
case CHEAT_RATE:
|
||||
r_showfps = r_showfps+1;
|
||||
if (r_showfps > 3)
|
||||
r_showfps = 0;
|
||||
|
||||
r_showfps = clamp(*r_showfps+1, 0, 3);
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
|
|
|
@ -152,6 +152,7 @@ struct GameInterface : ::GameInterface
|
|||
void set_hud_layout(int size) override;
|
||||
void set_hud_scale(int size) override;
|
||||
bool mouseInactiveConditional(bool condition) override;
|
||||
FString statFPS() override;
|
||||
};
|
||||
|
||||
END_DUKE_NS
|
||||
|
|
|
@ -6432,6 +6432,8 @@ MAIN_LOOP_RESTART:
|
|||
bool gameUpdate = false;
|
||||
double gameUpdateStartTime = timerGetHiTicks();
|
||||
|
||||
auto beforeMoveClock = ototalclock;
|
||||
|
||||
if (((g_netClient || g_netServer) || (myplayer.gm & (MODE_MENU|MODE_DEMO)) == 0) && totalclock >= ototalclock+TICSPERFRAME)
|
||||
{
|
||||
do
|
||||
|
@ -6509,7 +6511,7 @@ MAIN_LOOP_RESTART:
|
|||
videoNextPage();
|
||||
|
||||
if (gameUpdate)
|
||||
g_gameUpdateAndDrawTime = timerGetHiTicks()-gameUpdateStartTime;
|
||||
g_gameUpdateAndDrawTime = g_beforeSwapTime/* timerGetHiTicks()*/ - gameUpdateStartTime;
|
||||
|
||||
frameJustDrawn = true;
|
||||
}
|
||||
|
|
|
@ -680,8 +680,9 @@ static void G_PrintCoords(int32_t snum)
|
|||
|
||||
#define FPS_COLOR(x) ((x) ? COLOR_RED : COLOR_WHITE)
|
||||
|
||||
static void G_PrintFPS(void)
|
||||
FString GameInterface::statFPS(void)
|
||||
{
|
||||
FString output;
|
||||
static int32_t frameCount;
|
||||
static double cumulativeFrameDelay;
|
||||
static double lastFrameTime;
|
||||
|
@ -696,66 +697,31 @@ static void G_PrintFPS(void)
|
|||
{
|
||||
int32_t x = (xdim <= 640);
|
||||
|
||||
if (r_showfps)
|
||||
//if (r_showfps)
|
||||
{
|
||||
int32_t chars = Bsprintf(tempbuf, "%.1f ms, %5.1f fps", frameDelay, lastFPS);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+1+FPS_YOFFSET,
|
||||
FPS_COLOR(lastFPS < LOW_FPS), -1, tempbuf, x);
|
||||
output.AppendFormat("%.1f ms, %5.1f fps\n", frameDelay, lastFPS);
|
||||
|
||||
if (r_showfps > 1)
|
||||
{
|
||||
chars = Bsprintf(tempbuf, "max: %5.1f fps", maxFPS);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+10+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+10+FPS_YOFFSET,
|
||||
FPS_COLOR(maxFPS < LOW_FPS), -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "min: %5.1f fps", minFPS);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+20+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+20+FPS_YOFFSET,
|
||||
FPS_COLOR(minFPS < LOW_FPS), -1, tempbuf, x);
|
||||
output.AppendFormat("max: %5.1f fps\n", maxFPS);
|
||||
output.AppendFormat("min: %5.1f fps\n", minFPS);
|
||||
}
|
||||
if (r_showfps > 2)
|
||||
{
|
||||
if (g_gameUpdateTime > maxGameUpdate) maxGameUpdate = g_gameUpdateTime;
|
||||
if (g_gameUpdateTime < minGameUpdate) minGameUpdate = g_gameUpdateTime;
|
||||
|
||||
chars = Bsprintf(tempbuf, "Game Update: %2.2f ms + draw: %2.2f ms", g_gameUpdateTime, g_gameUpdateAndDrawTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+30+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+30+FPS_YOFFSET,
|
||||
FPS_COLOR(g_gameUpdateAndDrawTime >= SLOW_FRAME_TIME), -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "GU min/max/avg: %5.2f/%5.2f/%5.2f ms", minGameUpdate, maxGameUpdate, g_gameUpdateAvgTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+40+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+40+FPS_YOFFSET,
|
||||
FPS_COLOR(maxGameUpdate >= SLOW_FRAME_TIME), -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "G_MoveActors(): %.3e ms", g_moveActorsTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+50+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+50+FPS_YOFFSET,
|
||||
COLOR_WHITE, -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "G_MoveWorld(): %.3e ms", g_moveWorldTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+60+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+60+FPS_YOFFSET,
|
||||
COLOR_WHITE, -1, tempbuf, x);
|
||||
output.AppendFormat("Game Update: %2.2f ms + draw: %2.2f ms\n", g_gameUpdateTime, g_gameUpdateAndDrawTime - g_gameUpdateTime);
|
||||
output.AppendFormat("GU min/max/avg: %5.2f/%5.2f/%5.2f ms\n", minGameUpdate, maxGameUpdate, g_gameUpdateAvgTime);
|
||||
output.AppendFormat("G_MoveActors(): %.3f ms\n", g_moveActorsTime);
|
||||
output.AppendFormat("G_MoveWorld(): %.3f ms\n", g_moveWorldTime);
|
||||
}
|
||||
|
||||
// lag meter
|
||||
if (g_netClientPeer)
|
||||
{
|
||||
chars = Bsprintf(tempbuf, "%d +- %d ms", (g_netClientPeer->lastRoundTripTime + g_netClientPeer->roundTripTime)/2,
|
||||
output.AppendFormat("%d +- %d ms\n", (g_netClientPeer->lastRoundTripTime + g_netClientPeer->roundTripTime)/2,
|
||||
(g_netClientPeer->lastRoundTripTimeVariance + g_netClientPeer->roundTripTimeVariance)/2);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+30+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+30+1+FPS_YOFFSET, FPS_COLOR(g_netClientPeer->lastRoundTripTime > 200), -1, tempbuf, x);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -786,6 +752,7 @@ static void G_PrintFPS(void)
|
|||
frameCount++;
|
||||
}
|
||||
lastFrameTime = frameTime;
|
||||
return output;
|
||||
}
|
||||
|
||||
#undef FPS_COLOR
|
||||
|
@ -1119,8 +1086,6 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
mdpause = (ud.pause_on || (ud.recstat==2 && (g_demo_paused && g_demo_goalCnt==0)) || (g_player[myconnectindex].ps->gm&MODE_MENU && numplayers < 2));
|
||||
#endif
|
||||
|
||||
G_PrintFPS();
|
||||
|
||||
// JBF 20040124: display level stats in screen corner
|
||||
if (ud.overhead_on != 2 && hud_stats && VM_OnEvent(EVENT_DISPLAYLEVELSTATS, g_player[screenpeek].ps->i, screenpeek) == 0)
|
||||
{
|
||||
|
|
|
@ -673,10 +673,7 @@ void G_DoCheats(void)
|
|||
return;
|
||||
|
||||
case CHEAT_RATE:
|
||||
r_showfps = r_showfps+1;
|
||||
if (r_showfps > 3)
|
||||
r_showfps = 0;
|
||||
|
||||
r_showfps = clamp(*r_showfps+1, 0, 3);
|
||||
end_cheat(pPlayer);
|
||||
return;
|
||||
|
||||
|
|
|
@ -156,6 +156,7 @@ struct GameInterface : ::GameInterface
|
|||
void set_hud_layout(int size) override;
|
||||
void set_hud_scale(int size) override;
|
||||
bool mouseInactiveConditional(bool condition) override;
|
||||
FString statFPS() override;
|
||||
};
|
||||
|
||||
END_RR_NS
|
||||
|
|
|
@ -7942,7 +7942,7 @@ MAIN_LOOP_RESTART:
|
|||
|
||||
if (gameUpdate)
|
||||
{
|
||||
g_gameUpdateAndDrawTime = timerGetHiTicks()-gameUpdateStartTime;
|
||||
g_gameUpdateAndDrawTime = g_beforeSwapTime/* timerGetHiTicks()*/ - gameUpdateStartTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -676,8 +676,9 @@ static void G_PrintCoords(int32_t snum)
|
|||
|
||||
#define FPS_COLOR(x) ((x) ? COLOR_RED : COLOR_WHITE)
|
||||
|
||||
static void G_PrintFPS(void)
|
||||
FString GameInterface::statFPS()
|
||||
{
|
||||
FString output;
|
||||
static int32_t frameCount;
|
||||
static double cumulativeFrameDelay;
|
||||
static double lastFrameTime;
|
||||
|
@ -692,66 +693,31 @@ static void G_PrintFPS(void)
|
|||
{
|
||||
int32_t x = (xdim <= 640);
|
||||
|
||||
if (r_showfps)
|
||||
//if (r_showfps)
|
||||
{
|
||||
int32_t chars = Bsprintf(tempbuf, "%.1f ms, %5.1f fps", frameDelay, lastFPS);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+1+FPS_YOFFSET,
|
||||
FPS_COLOR(lastFPS < LOW_FPS), -1, tempbuf, x);
|
||||
output.AppendFormat("%.1f ms, %5.1f fps\n", frameDelay, lastFPS);
|
||||
|
||||
if (r_showfps > 1)
|
||||
{
|
||||
chars = Bsprintf(tempbuf, "max: %5.1f fps", maxFPS);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+10+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+10+FPS_YOFFSET,
|
||||
FPS_COLOR(maxFPS < LOW_FPS), -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "min: %5.1f fps", minFPS);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+20+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+20+FPS_YOFFSET,
|
||||
FPS_COLOR(minFPS < LOW_FPS), -1, tempbuf, x);
|
||||
output.AppendFormat("max: %5.1f fps\n", maxFPS);
|
||||
output.AppendFormat("min: %5.1f fps\n", minFPS);
|
||||
}
|
||||
if (r_showfps > 2)
|
||||
{
|
||||
if (g_gameUpdateTime > maxGameUpdate) maxGameUpdate = g_gameUpdateTime;
|
||||
if (g_gameUpdateTime < minGameUpdate) minGameUpdate = g_gameUpdateTime;
|
||||
|
||||
chars = Bsprintf(tempbuf, "Game Update: %2.2f ms + draw: %2.2f ms", g_gameUpdateTime, g_gameUpdateAndDrawTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+30+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+30+FPS_YOFFSET,
|
||||
FPS_COLOR(g_gameUpdateAndDrawTime >= SLOW_FRAME_TIME), -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "GU min/max/avg: %5.2f/%5.2f/%5.2f ms", minGameUpdate, maxGameUpdate, g_gameUpdateAvgTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+40+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+40+FPS_YOFFSET,
|
||||
FPS_COLOR(maxGameUpdate >= SLOW_FRAME_TIME), -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "G_MoveActors(): %.3e ms", g_moveActorsTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+50+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+50+FPS_YOFFSET,
|
||||
COLOR_WHITE, -1, tempbuf, x);
|
||||
|
||||
chars = Bsprintf(tempbuf, "G_MoveWorld(): %.3e ms", g_moveWorldTime);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+60+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+60+FPS_YOFFSET,
|
||||
COLOR_WHITE, -1, tempbuf, x);
|
||||
output.AppendFormat("Game Update: %2.2f ms + draw: %2.2f ms\n", g_gameUpdateTime, g_gameUpdateAndDrawTime - g_gameUpdateTime);
|
||||
output.AppendFormat("GU min/max/avg: %5.2f/%5.2f/%5.2f ms\n", minGameUpdate, maxGameUpdate, g_gameUpdateAvgTime);
|
||||
output.AppendFormat("G_MoveActors(): %.3f ms\n", g_moveActorsTime);
|
||||
output.AppendFormat("G_MoveWorld(): %.3f ms\n", g_moveWorldTime);
|
||||
}
|
||||
|
||||
// lag meter
|
||||
if (g_netClientPeer)
|
||||
{
|
||||
chars = Bsprintf(tempbuf, "%d +- %d ms", (g_netClientPeer->lastRoundTripTime + g_netClientPeer->roundTripTime)/2,
|
||||
(g_netClientPeer->lastRoundTripTimeVariance + g_netClientPeer->roundTripTimeVariance)/2);
|
||||
|
||||
printext256(windowxy2.x-(chars<<(3-x))+1, windowxy1.y+30+2+FPS_YOFFSET, 0, -1, tempbuf, x);
|
||||
printext256(windowxy2.x-(chars<<(3-x)), windowxy1.y+30+1+FPS_YOFFSET, FPS_COLOR(g_netClientPeer->lastRoundTripTime > 200), -1, tempbuf, x);
|
||||
output.AppendFormat("%d +- %d ms\n", (g_netClientPeer->lastRoundTripTime + g_netClientPeer->roundTripTime)/2,
|
||||
(g_netClientPeer->lastRoundTripTimeVariance + g_netClientPeer->roundTripTimeVariance) / 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -782,6 +748,7 @@ static void G_PrintFPS(void)
|
|||
frameCount++;
|
||||
}
|
||||
lastFrameTime = frameTime;
|
||||
return output;
|
||||
}
|
||||
|
||||
#undef FPS_COLOR
|
||||
|
@ -1123,8 +1090,6 @@ void G_DisplayRest(int32_t smoothratio)
|
|||
mdpause = (ud.pause_on || (ud.recstat==2 && (g_demo_paused && g_demo_goalCnt==0)) || (g_player[myconnectindex].ps->gm&MODE_MENU && numplayers < 2));
|
||||
#endif
|
||||
|
||||
G_PrintFPS();
|
||||
|
||||
// JBF 20040124: display level stats in screen corner
|
||||
if (ud.overhead_on != 2 && hud_stats)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue