mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-04-26 16:46:28 +00:00
[client] pre-calculate the frame time
This commit is contained in:
parent
692d48df87
commit
5842ce23a3
@ -68,6 +68,7 @@ struct AppState
|
|||||||
struct KVMFRHeader * shm;
|
struct KVMFRHeader * shm;
|
||||||
unsigned int shmSize;
|
unsigned int shmSize;
|
||||||
|
|
||||||
|
uint64_t frameTime;
|
||||||
uint64_t lastFrameTime;
|
uint64_t lastFrameTime;
|
||||||
uint64_t renderTime;
|
uint64_t renderTime;
|
||||||
uint64_t frameCount;
|
uint64_t frameCount;
|
||||||
@ -222,7 +223,7 @@ int renderThread(void * unused)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t nsec = time.tv_nsec + (1e9 / params.fpsLimit);
|
uint64_t nsec = time.tv_nsec + state.frameTime;
|
||||||
if (nsec > 1e9)
|
if (nsec > 1e9)
|
||||||
{
|
{
|
||||||
time.tv_nsec = nsec - 1e9;
|
time.tv_nsec = nsec - 1e9;
|
||||||
@ -760,6 +761,7 @@ int run()
|
|||||||
state.running = true;
|
state.running = true;
|
||||||
state.scaleX = 1.0f;
|
state.scaleX = 1.0f;
|
||||||
state.scaleY = 1.0f;
|
state.scaleY = 1.0f;
|
||||||
|
state.frameTime = 1e9 / params.fpsLimit;
|
||||||
|
|
||||||
char* XDG_SESSION_TYPE = getenv("XDG_SESSION_TYPE");
|
char* XDG_SESSION_TYPE = getenv("XDG_SESSION_TYPE");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user