mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-10-16 12:28:11 +00:00
overlay: move init/free to the context of the render thread
This is done to allow overlays to make use of the renderer during init/free.
This commit is contained in:
@@ -46,16 +46,14 @@ OverlayConfig;
|
||||
|
||||
static OverlayConfig cfg = { 0 };
|
||||
|
||||
static bool config_init(void ** udata, const void * params)
|
||||
static void config_earlyInit(void)
|
||||
{
|
||||
cfg.callbacks = ll_new();
|
||||
cfg.tabCallbacks = ll_new();
|
||||
if (!cfg.callbacks)
|
||||
{
|
||||
DEBUG_ERROR("failed to allocate ram");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool config_init(void ** udata, const void * params)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -239,6 +237,7 @@ static int config_render(void * udata, bool interactive, struct Rect * windowRec
|
||||
struct LG_OverlayOps LGOverlayConfig =
|
||||
{
|
||||
.name = "Config",
|
||||
.earlyInit = config_earlyInit,
|
||||
.init = config_init,
|
||||
.free = config_free,
|
||||
.render = config_render
|
||||
|
@@ -70,9 +70,13 @@ static void showTimingKeybind(int sc, void * opaque)
|
||||
app_invalidateWindow(false);
|
||||
}
|
||||
|
||||
static bool graphs_init(void ** udata, const void * params)
|
||||
static void graphs_earlyInit(void)
|
||||
{
|
||||
gs.graphs = ll_new();
|
||||
}
|
||||
|
||||
static bool graphs_init(void ** udata, const void * params)
|
||||
{
|
||||
app_overlayConfigRegister("Performance Metrics", configCallback, NULL);
|
||||
app_registerKeybind(KEY_T, showTimingKeybind, NULL,
|
||||
"Show frame timing information");
|
||||
@@ -207,6 +211,7 @@ static int graphs_render(void * udata, bool interactive,
|
||||
struct LG_OverlayOps LGOverlayGraphs =
|
||||
{
|
||||
.name = "Graphs",
|
||||
.earlyInit = graphs_earlyInit,
|
||||
.init = graphs_init,
|
||||
.free = graphs_free,
|
||||
.render = graphs_render
|
||||
|
@@ -46,9 +46,13 @@ struct MsgState
|
||||
|
||||
struct MsgState l_msg = { 0 };
|
||||
|
||||
static bool msg_init(void ** udata, const void * params)
|
||||
static void msg_earlyInit(void)
|
||||
{
|
||||
l_msg.messages = ll_new();
|
||||
}
|
||||
|
||||
static bool msg_init(void ** udata, const void * params)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -168,6 +172,7 @@ static int msg_render(void * udata, bool interactive, struct Rect * windowRects,
|
||||
struct LG_OverlayOps LGOverlayMsg =
|
||||
{
|
||||
.name = "msg",
|
||||
.earlyInit = msg_earlyInit,
|
||||
.init = msg_init,
|
||||
.free = msg_free,
|
||||
.needs_overlay = msg_needsOverlay,
|
||||
|
Reference in New Issue
Block a user