[client] add ImPlot and rework latency graphs

This commit is contained in:
Geoffrey McRae
2026-08-03 14:18:22 +10:00
parent 7533c855c2
commit 4f39270736
28 changed files with 539 additions and 172 deletions

View File

@@ -104,7 +104,6 @@ add_library(renderer_EGL STATIC
filter_downscale.c
${EGL_SHADER_OBJS}
"${CMAKE_CURRENT_BINARY_DIR}/shader/desktop_rgb.def.h"
${PROJECT_TOP}/repos/cimgui/imgui/backends/imgui_impl_opengl3.cpp
)
target_compile_definitions(renderer_EGL PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1 IMGUI_IMPL_OPENGL_ES3)
@@ -113,7 +112,7 @@ target_link_libraries(renderer_EGL
PkgConfig::RENDERER_EGL
lg_common
cimgui
lg_gui
)
if(RENDERER_EGL_OPT_FOUND)
target_link_libraries(renderer_EGL

View File

@@ -36,7 +36,7 @@
#include <GLES3/gl32.h>
#include "cimgui.h"
#include "generator/output/cimgui_impl.h"
#include "cimgui_impl.h"
#include <math.h>
#include <stdlib.h>
@@ -124,9 +124,6 @@ struct Inst
int overlayHistoryCount[DESKTOP_DAMAGE_COUNT];
unsigned int overlayHistoryIdx;
RingBuffer importTimings;
GraphHandle importGraph;
bool showSpice;
int spiceWidth, spiceHeight;
@@ -292,10 +289,6 @@ static bool egl_create(LG_Renderer ** renderer, const LG_RendererParams params,
LG_LOCK_INIT(this->desktopDamageLock);
this->desktopDamage[0].count = -1;
this->importTimings = ringbuffer_new(256, sizeof(float));
this->importGraph = app_registerGraph("IMPORT", this->importTimings,
0.0f, 5.0f, NULL);
*needsOpenGL = false;
return true;
}
@@ -317,8 +310,6 @@ static void egl_deinitialize(LG_Renderer * renderer)
egl_stateInvalidate();
}
ringbuffer_free(&this->importTimings);
egl_desktopFree(&this->desktop);
egl_cursorFree (&this->cursor);
egl_damageFree (&this->damage);
@@ -592,10 +583,8 @@ static void egl_onResize(LG_Renderer * renderer, const int width, const int heig
static bool egl_onFontUpdate(LG_Renderer * renderer)
{
ImGui_ImplOpenGL3_DestroyFontsTexture();
const bool result = ImGui_ImplOpenGL3_CreateFontsTexture();
egl_stateInvalidate();
return result;
return true;
}
static bool egl_onMouseShape(LG_Renderer * renderer, const LG_RendererCursor cursor,
@@ -759,14 +748,14 @@ static bool egl_onFrame(LG_Renderer * renderer, const FrameBuffer * frame, int d
struct Inst * this = UPCAST(struct Inst, renderer);
egl_stateCheckShared();
uint64_t start = nanotime();
const uint64_t start = nanotime();
if (unlikely(!egl_desktopUpdate(
this->desktop, frame, dmaFd, damageRects, damageRectsCount)))
{
DEBUG_INFO("Failed to to update the desktop");
return false;
}
ringbuffer_push(this->importTimings, &(float){ (nanotime() - start) * 1e-6f });
app_setFrameImportTime(nanotime() - start);
INTERLOCKED_SECTION(this->desktopDamageLock, {
struct DesktopDamage * damage = this->desktopDamage + this->desktopDamageIdx;

View File

@@ -496,10 +496,6 @@ static void configUI(void * opaque, int * id)
bool doMove = false;
ImVec2 window, pos;
igGetWindowPos(&window);
igGetMousePos(&pos);
EGL_Filter ** filters = vector_data(&this->filters);
size_t count = vector_size(&this->filters);
for (size_t i = 0; i < count; ++i)

View File

@@ -8,7 +8,6 @@ pkg_check_modules(RENDERER_OPENGL REQUIRED IMPORTED_TARGET
add_library(renderer_OpenGL STATIC
opengl.c
${PROJECT_TOP}/repos/cimgui/imgui/backends/imgui_impl_opengl2.cpp
)
target_compile_definitions(renderer_OpenGL PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1)
@@ -17,7 +16,7 @@ target_link_libraries(renderer_OpenGL
PkgConfig::RENDERER_OPENGL
lg_common
cimgui
lg_gui
)
target_include_directories(renderer_OpenGL

View File

@@ -29,7 +29,7 @@
#include <GL/gl.h>
#include "cimgui.h"
#include "generator/output/cimgui_impl.h"
#include "cimgui_impl.h"
#include "common/debug.h"
#include "common/option.h"
@@ -318,8 +318,7 @@ void opengl_onResize(LG_Renderer * renderer, const int width, const int height,
static bool opengl_onFontUpdate(LG_Renderer * renderer)
{
ImGui_ImplOpenGL2_DestroyFontsTexture();
return ImGui_ImplOpenGL2_CreateFontsTexture();
return true;
}
bool opengl_onMouseShape(LG_Renderer * renderer, const LG_RendererCursor cursor,