mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-25 23:07:18 +00:00
[client] apply fps limiter when presentation time is too low
This commit is contained in:
parent
786b9ec723
commit
5e9885bec1
@ -163,6 +163,12 @@ uint64_t detectPresentTime()
|
|||||||
const uint64_t t = (microtime() - start) / 20;
|
const uint64_t t = (microtime() - start) / 20;
|
||||||
|
|
||||||
DEBUG_INFO("detected: %lu (%f Hz)", t, 1000000.0f / t);
|
DEBUG_INFO("detected: %lu (%f Hz)", t, 1000000.0f / t);
|
||||||
|
if (t < 2000)
|
||||||
|
{
|
||||||
|
DEBUG_INFO("present time too low, setting framerate limit to %d Hz", FPS_LIMIT);
|
||||||
|
return ceil((1000000.0/(double)FPS_LIMIT));
|
||||||
|
}
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,11 +182,7 @@ int renderThread(void * unused)
|
|||||||
SDL_Texture * textTexture = NULL;
|
SDL_Texture * textTexture = NULL;
|
||||||
SDL_Rect textRect;
|
SDL_Rect textRect;
|
||||||
|
|
||||||
const uint64_t presentTime =
|
const uint64_t presentTime = detectPresentTime();
|
||||||
params.vsync ?
|
|
||||||
detectPresentTime() :
|
|
||||||
ceil((1000000.0/(double)FPS_LIMIT));
|
|
||||||
|
|
||||||
unsigned int lateCount = 0;
|
unsigned int lateCount = 0;
|
||||||
|
|
||||||
int pollDelay = 0;
|
int pollDelay = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user