diff --git a/client/include/interface/renderer.h b/client/include/interface/renderer.h index ae97c95d..6f07ab90 100644 --- a/client/include/interface/renderer.h +++ b/client/include/interface/renderer.h @@ -116,7 +116,7 @@ typedef bool (* LG_RendererOnFrame )(void * opaque, const FrameBuff typedef void (* LG_RendererOnAlert )(void * opaque, const LG_MsgAlert alert, const char * message, bool ** closeFlag); typedef void (* LG_RendererOnHelp )(void * opaque, const char * message); typedef bool (* LG_RendererRenderStartup)(void * opaque); -typedef bool (* LG_RendererRender )(void * opaque, LG_RendererRotate rotate); +typedef bool (* LG_RendererRender )(void * opaque, LG_RendererRotate rotate, const bool newFrame); typedef struct LG_Renderer { diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index 8a70c349..bba045d1 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -923,7 +923,7 @@ bool egl_render_startup(void * opaque) return true; } -bool egl_render(void * opaque, LG_RendererRotate rotate) +bool egl_render(void * opaque, LG_RendererRotate rotate, const bool newFrame) { struct Inst * this = (struct Inst *)opaque; diff --git a/client/renderers/OpenGL/opengl.c b/client/renderers/OpenGL/opengl.c index c22e4879..a0646acd 100644 --- a/client/renderers/OpenGL/opengl.c +++ b/client/renderers/OpenGL/opengl.c @@ -584,7 +584,7 @@ bool opengl_render_startup(void * opaque) return true; } -bool opengl_render(void * opaque, LG_RendererRotate rotate) +bool opengl_render(void * opaque, LG_RendererRotate rotate, const bool newFrame) { struct Inst * this = (struct Inst *)opaque; if (!this) diff --git a/client/src/main.c b/client/src/main.c index 1a19d215..0f4607d9 100644 --- a/client/src/main.c +++ b/client/src/main.c @@ -191,8 +191,14 @@ static int renderThread(void * unused) atomic_compare_exchange_weak(&g_state.lgrResize, &resize, 0); } + static uint64_t lastFrameCount = 0; + const uint64_t frameCount = + atomic_load_explicit(&g_state.frameCount, memory_order_relaxed); + const bool newFrame = frameCount != lastFrameCount; + lastFrameCount = frameCount; + LG_LOCK(g_state.lgrLock); - if (!g_state.lgr->render(g_state.lgrData, g_params.winRotate)) + if (!g_state.lgr->render(g_state.lgrData, g_params.winRotate, newFrame)) { LG_UNLOCK(g_state.lgrLock); break;