mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 14:21:57 +00:00
[client] prevent usleep underflow in FPS limiter
This commit is contained in:
parent
3adcbfaa7d
commit
5de9a8dce6
1 changed files with 4 additions and 3 deletions
|
@ -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 a new issue