mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-26 23:43:40 +00:00
[client] prevent usleep underflow in FPS limiter
This commit is contained in:
parent
3adcbfaa7d
commit
5de9a8dce6
@ -189,14 +189,15 @@ int renderThread(void * unused)
|
||||
{
|
||||
if (state.started)
|
||||
{
|
||||
uint64_t start = microtime();
|
||||
const uint64_t start = microtime();
|
||||
|
||||
if (!state.lgr->render(state.lgrData, state.window))
|
||||
break;
|
||||
|
||||
if (microtime() - start < state.fpsSleep)
|
||||
const uint64_t total = microtime() - start;
|
||||
if (total < state.fpsSleep)
|
||||
{
|
||||
usleep(state.fpsSleep - (microtime() - start));
|
||||
usleep(state.fpsSleep - total);
|
||||
int64_t delta = (1000000 / params.fpsLimit) - (microtime() - start);
|
||||
state.fpsSleep += delta;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user