mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
screens.cpp: Fixed a bug in FPS calculation
git-svn-id: https://svn.eduke32.com/eduke32@6660 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
8ebb8083a5
commit
512b396c54
1 changed files with 5 additions and 6 deletions
|
@ -782,11 +782,12 @@ static void G_ShowCacheLocks(void)
|
||||||
|
|
||||||
static void G_PrintFPS(void)
|
static void G_PrintFPS(void)
|
||||||
{
|
{
|
||||||
static int32_t frameCount = 0, lastFPS = 0, lastFrameTime = 0;
|
static int32_t frameCount = 0, lastFPS = 0, lastFrameTime = 0, cumulativeFrameDelay = 0;
|
||||||
static int32_t minFPS = -1, maxFPS = 0;
|
static int32_t minFPS = -1, maxFPS = 0;
|
||||||
|
|
||||||
int32_t frameTime = getticks();
|
int32_t frameTime = getticks();
|
||||||
int32_t frameDelay = frameTime - lastFrameTime;
|
int32_t frameDelay = frameTime - lastFrameTime;
|
||||||
|
cumulativeFrameDelay += frameDelay;
|
||||||
|
|
||||||
if (frameDelay >= 0)
|
if (frameDelay >= 0)
|
||||||
{
|
{
|
||||||
|
@ -826,13 +827,11 @@ static void G_PrintFPS(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t const thisSec = tabledivide32_noinline(frameTime, 1000);
|
if (cumulativeFrameDelay >= 1000)
|
||||||
int32_t const lastSec = tabledivide32_noinline(lastFrameTime, 1000);
|
|
||||||
|
|
||||||
if (thisSec - lastSec)
|
|
||||||
{
|
{
|
||||||
g_frameRate = lastFPS = tabledivide32_noinline(frameCount, thisSec - lastSec);
|
g_frameRate = lastFPS = tabledivide32_noinline(1000*frameCount, cumulativeFrameDelay);
|
||||||
frameCount = 0;
|
frameCount = 0;
|
||||||
|
cumulativeFrameDelay = 0;
|
||||||
|
|
||||||
if (ud.showfps > 1)
|
if (ud.showfps > 1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue