mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[client] overlay: add new needs_render
for realtime overlays
This commit is contained in:
parent
23c77e8508
commit
e23144aecd
@ -85,7 +85,7 @@ void app_glSwapBuffers(void);
|
||||
#define MAX_OVERLAY_RECTS 10
|
||||
void app_registerOverlay(const struct LG_OverlayOps * ops, void * params);
|
||||
void app_setOverlay(bool enable);
|
||||
|
||||
bool app_overlayNeedsRender(void);
|
||||
/**
|
||||
* render the overlay
|
||||
* returns:
|
||||
|
@ -37,6 +37,10 @@ struct LG_OverlayOps
|
||||
/* final free */
|
||||
void (*free)(void * udata);
|
||||
|
||||
/* return true if realtime rendering is required when in jitRender mode
|
||||
* optional, if omitted assumes false */
|
||||
bool (*needs_render)(void * udata, bool interactive);
|
||||
|
||||
/* perform the actual drawing/rendering
|
||||
*
|
||||
* `interactive` is true if the application is currently in overlay interaction
|
||||
|
@ -734,6 +734,26 @@ static inline LG_DSPointer mapImGuiCursor(ImGuiMouseCursor cursor)
|
||||
}
|
||||
}
|
||||
|
||||
bool app_overlayNeedsRender(void)
|
||||
{
|
||||
struct Overlay * overlay;
|
||||
|
||||
if (g_state.overlayInput)
|
||||
return true;
|
||||
|
||||
for (ll_reset(g_state.overlays);
|
||||
ll_walk(g_state.overlays, (void **)&overlay); )
|
||||
{
|
||||
if (!overlay->ops->needs_render)
|
||||
continue;
|
||||
|
||||
if (overlay->ops->needs_render(overlay->udata, g_state.overlayInput))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int app_renderOverlay(struct Rect * rects, int maxRects)
|
||||
{
|
||||
int totalRects = 0;
|
||||
|
@ -174,7 +174,9 @@ static int renderThread(void * unused)
|
||||
|
||||
const uint64_t pending =
|
||||
atomic_load_explicit(&g_state.pendingCount, memory_order_acquire);
|
||||
if (!lgResetEvent(g_state.frameEvent) && !pending && !g_state.overlayInput
|
||||
if (!lgResetEvent(g_state.frameEvent)
|
||||
&& !pending
|
||||
&& !app_overlayNeedsRender()
|
||||
&& !g_state.lgr->needs_render(g_state.lgrData))
|
||||
{
|
||||
if (g_state.ds->skipFrame)
|
||||
|
Loading…
Reference in New Issue
Block a user