mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-02 05:12:02 +00:00
[client] renderers: only rebuild the font atlas if marked dirty
This commit is contained in:
@@ -1157,7 +1157,7 @@ void app_registerImGuiText(const char * text)
|
||||
if (!util_uiFontAddText(text))
|
||||
return;
|
||||
|
||||
atomic_fetch_add(&g_state.lgrResize, 1);
|
||||
atomic_store(&g_state.fontDirty, true);
|
||||
app_invalidateOverlay(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -268,11 +268,23 @@ static int renderThread(void * unused)
|
||||
.y = g_state.windowScale,
|
||||
};
|
||||
g_state.io->FontGlobalScale = 1.0f / g_state.windowScale;
|
||||
}
|
||||
|
||||
const bool fontDirty = atomic_exchange(&g_state.fontDirty, false);
|
||||
if (unlikely(fontDirty || g_state.fontScale != g_state.windowScale))
|
||||
{
|
||||
if (!util_buildUIFontAtlas(g_state.io->Fonts,
|
||||
g_params.uiSize * g_state.windowScale, &g_state.fontLarge))
|
||||
DEBUG_FATAL("Failed to build font atlas: %s (%s)", g_params.uiFont, g_state.fontName);
|
||||
|
||||
if (g_state.lgr && !RENDERER(onFontUpdate))
|
||||
DEBUG_FATAL("Failed to upload the ImGui font atlas");
|
||||
|
||||
g_state.fontScale = g_state.windowScale;
|
||||
}
|
||||
|
||||
if (unlikely(resize))
|
||||
{
|
||||
if (g_state.lgr)
|
||||
RENDERER(onResize, g_state.windowW, g_state.windowH,
|
||||
g_state.windowScale, g_state.dstRect, g_params.winRotate);
|
||||
|
||||
@@ -106,6 +106,7 @@ struct AppState
|
||||
int windowW, windowH;
|
||||
int windowCX, windowCY;
|
||||
double windowScale;
|
||||
double fontScale;
|
||||
LG_RendererRotate rotate;
|
||||
bool focused;
|
||||
struct Border border;
|
||||
@@ -120,6 +121,7 @@ struct AppState
|
||||
|
||||
LG_Renderer * lgr;
|
||||
atomic_int lgrResize;
|
||||
atomic_bool fontDirty;
|
||||
LG_Lock lgrLock;
|
||||
bool useDMA;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user