mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[client] imgui: make graph y-axis configurable
The default of [0, 50] makes sense for FPS/UPS graphs, but does not for things like the import graph. The latter should not take more than 5 ms for sure. This commit allows the min/max y-axis value to be specified when registering the graph.
This commit is contained in:
parent
aff3bff8b0
commit
134829cbf2
@ -86,7 +86,7 @@ bool waylandPresentationInit(void)
|
|||||||
if (wlWm.presentation)
|
if (wlWm.presentation)
|
||||||
{
|
{
|
||||||
wlWm.photonTimings = ringbuffer_new(256, sizeof(float));
|
wlWm.photonTimings = ringbuffer_new(256, sizeof(float));
|
||||||
wlWm.photonGraph = app_registerGraph("PHOTON", wlWm.photonTimings);
|
wlWm.photonGraph = app_registerGraph("PHOTON", wlWm.photonTimings, 0.0f, 30.0f);
|
||||||
wp_presentation_add_listener(wlWm.presentation, &presentationListener, NULL);
|
wp_presentation_add_listener(wlWm.presentation, &presentationListener, NULL);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -98,7 +98,7 @@ void app_freeOverlays(void);
|
|||||||
struct OverlayGraph;
|
struct OverlayGraph;
|
||||||
typedef struct OverlayGraph * GraphHandle;
|
typedef struct OverlayGraph * GraphHandle;
|
||||||
|
|
||||||
GraphHandle app_registerGraph(const char * name, RingBuffer buffer);
|
GraphHandle app_registerGraph(const char * name, RingBuffer buffer, float min, float max);
|
||||||
void app_unregisterGraph(GraphHandle handle);
|
void app_unregisterGraph(GraphHandle handle);
|
||||||
|
|
||||||
void app_clipboardRelease(void);
|
void app_clipboardRelease(void);
|
||||||
|
@ -214,7 +214,7 @@ bool egl_create(void ** opaque, const LG_RendererParams params, bool * needsOpen
|
|||||||
atomic_init(&this->desktopDamage, NULL);
|
atomic_init(&this->desktopDamage, NULL);
|
||||||
|
|
||||||
this->importTimings = ringbuffer_new(256, sizeof(float));
|
this->importTimings = ringbuffer_new(256, sizeof(float));
|
||||||
this->importGraph = app_registerGraph("IMPORT", this->importTimings);
|
this->importGraph = app_registerGraph("IMPORT", this->importTimings, 0.0f, 5.0f);
|
||||||
|
|
||||||
*needsOpenGL = false;
|
*needsOpenGL = false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -565,9 +565,9 @@ void app_releaseAllKeybinds(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphHandle app_registerGraph(const char * name, RingBuffer buffer)
|
GraphHandle app_registerGraph(const char * name, RingBuffer buffer, float min, float max)
|
||||||
{
|
{
|
||||||
return overlayGraph_register(name, buffer);
|
return overlayGraph_register(name, buffer, min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
void app_unregisterGraph(GraphHandle handle)
|
void app_unregisterGraph(GraphHandle handle)
|
||||||
|
@ -793,8 +793,8 @@ static int lg_run(void)
|
|||||||
// initialize metrics ringbuffers
|
// initialize metrics ringbuffers
|
||||||
g_state.renderTimings = ringbuffer_new(256, sizeof(float));
|
g_state.renderTimings = ringbuffer_new(256, sizeof(float));
|
||||||
g_state.frameTimings = ringbuffer_new(256, sizeof(float));
|
g_state.frameTimings = ringbuffer_new(256, sizeof(float));
|
||||||
overlayGraph_register("RENDER", g_state.renderTimings);
|
overlayGraph_register("RENDER", g_state.renderTimings, 0.0f, 50.0f);
|
||||||
overlayGraph_register("UPLOAD", g_state.frameTimings );
|
overlayGraph_register("UPLOAD", g_state.frameTimings , 0.0f, 50.0f);
|
||||||
|
|
||||||
// search for the best displayserver ops to use
|
// search for the best displayserver ops to use
|
||||||
for(int i = 0; i < LG_DISPLAYSERVER_COUNT; ++i)
|
for(int i = 0; i < LG_DISPLAYSERVER_COUNT; ++i)
|
||||||
|
@ -39,6 +39,8 @@ struct OverlayGraph
|
|||||||
const char * name;
|
const char * name;
|
||||||
RingBuffer buffer;
|
RingBuffer buffer;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
float min;
|
||||||
|
float max;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool graphs_init(void ** udata, void * params)
|
static bool graphs_init(void ** udata, void * params)
|
||||||
@ -135,8 +137,8 @@ static int graphs_render(void * udata, bool interactive,
|
|||||||
ringbuffer_getLength(graph->buffer),
|
ringbuffer_getLength(graph->buffer),
|
||||||
ringbuffer_getStart (graph->buffer),
|
ringbuffer_getStart (graph->buffer),
|
||||||
title,
|
title,
|
||||||
0.0f,
|
graph->min,
|
||||||
50.0f,
|
graph->max,
|
||||||
size,
|
size,
|
||||||
sizeof(float));
|
sizeof(float));
|
||||||
};
|
};
|
||||||
@ -154,12 +156,14 @@ struct LG_OverlayOps LGOverlayGraphs =
|
|||||||
.render = graphs_render
|
.render = graphs_render
|
||||||
};
|
};
|
||||||
|
|
||||||
GraphHandle overlayGraph_register(const char * name, RingBuffer buffer)
|
GraphHandle overlayGraph_register(const char * name, RingBuffer buffer, float min, float max)
|
||||||
{
|
{
|
||||||
struct OverlayGraph * graph = malloc(sizeof(struct OverlayGraph));
|
struct OverlayGraph * graph = malloc(sizeof(struct OverlayGraph));
|
||||||
graph->name = name;
|
graph->name = name;
|
||||||
graph->buffer = buffer;
|
graph->buffer = buffer;
|
||||||
graph->enabled = true;
|
graph->enabled = true;
|
||||||
|
graph->min = min;
|
||||||
|
graph->max = max;
|
||||||
ll_push(gs.graphs, graph);
|
ll_push(gs.graphs, graph);
|
||||||
return graph;
|
return graph;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ extern struct LG_OverlayOps LGOverlayFPS;
|
|||||||
extern struct LG_OverlayOps LGOverlayGraphs;
|
extern struct LG_OverlayOps LGOverlayGraphs;
|
||||||
extern struct LG_OverlayOps LGOverlayHelp;
|
extern struct LG_OverlayOps LGOverlayHelp;
|
||||||
|
|
||||||
GraphHandle overlayGraph_register(const char * name, RingBuffer buffer);
|
GraphHandle overlayGraph_register(const char * name, RingBuffer buffer, float min, float max);
|
||||||
void overlayGraph_unregister();
|
void overlayGraph_unregister();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user