mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-26 07:17:23 +00:00
[client] imgui: use signalNextFrame if possible
This allows imgui to be rendered at screen refresh rate for supported display server backends.
This commit is contained in:
parent
a213ee960a
commit
c8dc037e94
@ -166,7 +166,9 @@ static int renderThread(void * unused)
|
|||||||
|
|
||||||
while(g_state.state != APP_STATE_SHUTDOWN)
|
while(g_state.state != APP_STATE_SHUTDOWN)
|
||||||
{
|
{
|
||||||
if (g_params.fpsMin != 0)
|
if (g_state.overlayMustWait)
|
||||||
|
lgWaitEvent(g_state.overlayRenderEvent, TIMEOUT_INFINITE);
|
||||||
|
else if (g_params.fpsMin != 0)
|
||||||
{
|
{
|
||||||
float ups = atomic_load_explicit(&g_state.ups, memory_order_relaxed);
|
float ups = atomic_load_explicit(&g_state.ups, memory_order_relaxed);
|
||||||
|
|
||||||
@ -179,6 +181,14 @@ static int renderThread(void * unused)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_state.overlayInput && g_state.ds->signalNextFrame)
|
||||||
|
{
|
||||||
|
g_state.ds->signalNextFrame(g_state.overlayRenderEvent);
|
||||||
|
g_state.overlayMustWait = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_state.overlayMustWait = false;
|
||||||
|
|
||||||
int resize = atomic_load(&g_state.lgrResize);
|
int resize = atomic_load(&g_state.lgrResize);
|
||||||
if (resize)
|
if (resize)
|
||||||
{
|
{
|
||||||
@ -966,6 +976,12 @@ static int lg_run(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(g_state.overlayRenderEvent = lgCreateEvent(true, 0)))
|
||||||
|
{
|
||||||
|
DEBUG_ERROR("failed to create the overlay render event");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
lgInit();
|
lgInit();
|
||||||
|
|
||||||
// start the renderThread so we don't just display junk
|
// start the renderThread so we don't just display junk
|
||||||
@ -1145,6 +1161,12 @@ static void lg_shutdown(void)
|
|||||||
g_state.frameEvent = NULL;
|
g_state.frameEvent = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_state.overlayRenderEvent)
|
||||||
|
{
|
||||||
|
lgFreeEvent(g_state.overlayRenderEvent);
|
||||||
|
g_state.overlayRenderEvent = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (e_startup)
|
if (e_startup)
|
||||||
{
|
{
|
||||||
lgFreeEvent(e_startup);
|
lgFreeEvent(e_startup);
|
||||||
|
@ -55,6 +55,8 @@ struct AppState
|
|||||||
ImFont * fontLarge;
|
ImFont * fontLarge;
|
||||||
bool overlayInput;
|
bool overlayInput;
|
||||||
ImGuiMouseCursor cursorLast;
|
ImGuiMouseCursor cursorLast;
|
||||||
|
LGEvent * overlayRenderEvent;
|
||||||
|
bool overlayMustWait;
|
||||||
|
|
||||||
bool alertShow;
|
bool alertShow;
|
||||||
char * alertMessage;
|
char * alertMessage;
|
||||||
|
Loading…
Reference in New Issue
Block a user