mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-01-25 12:58:10 +00:00
[client] overlay: add new needs_render
for realtime overlays
This commit is contained in:
parent
23c77e8508
commit
e23144aecd
4 changed files with 28 additions and 2 deletions
|
@ -85,7 +85,7 @@ void app_glSwapBuffers(void);
|
||||||
#define MAX_OVERLAY_RECTS 10
|
#define MAX_OVERLAY_RECTS 10
|
||||||
void app_registerOverlay(const struct LG_OverlayOps * ops, void * params);
|
void app_registerOverlay(const struct LG_OverlayOps * ops, void * params);
|
||||||
void app_setOverlay(bool enable);
|
void app_setOverlay(bool enable);
|
||||||
|
bool app_overlayNeedsRender(void);
|
||||||
/**
|
/**
|
||||||
* render the overlay
|
* render the overlay
|
||||||
* returns:
|
* returns:
|
||||||
|
|
|
@ -37,6 +37,10 @@ struct LG_OverlayOps
|
||||||
/* final free */
|
/* final free */
|
||||||
void (*free)(void * udata);
|
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
|
/* perform the actual drawing/rendering
|
||||||
*
|
*
|
||||||
* `interactive` is true if the application is currently in overlay interaction
|
* `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 app_renderOverlay(struct Rect * rects, int maxRects)
|
||||||
{
|
{
|
||||||
int totalRects = 0;
|
int totalRects = 0;
|
||||||
|
|
|
@ -174,7 +174,9 @@ static int renderThread(void * unused)
|
||||||
|
|
||||||
const uint64_t pending =
|
const uint64_t pending =
|
||||||
atomic_load_explicit(&g_state.pendingCount, memory_order_acquire);
|
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))
|
&& !g_state.lgr->needs_render(g_state.lgrData))
|
||||||
{
|
{
|
||||||
if (g_state.ds->skipFrame)
|
if (g_state.ds->skipFrame)
|
||||||
|
|
Loading…
Reference in a new issue