vtgl

terminal emulator implemented in OpenGL
git clone anongit@rnpnr.xyz:vtgl.git
Log | Files | Refs | Feed | LICENSE

Commit: 14e0160333868651534fc9fff110d1744109c5d5
Parent: 11430fa3a841a123d3b8369a119971d58902b454
Author: Randy Palamar
Date:   Wed,  6 Nov 2024 09:17:49 -0700

make sure debug overlay can access the state

Diffstat:
Mdebug.c | 7++++---
Mdebug.h | 3++-
Mutil.h | 2--
Mvtgl.c | 6++++--
4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/debug.c b/debug.c @@ -295,15 +295,16 @@ draw_debug_bar_chart(Term *t, DebugState *ds, RenderCtx *rc, v2 bar_chart_top_le } static void -draw_debug_overlay(Term *t, RenderCtx *rc) +draw_debug_overlay(TerminalMemory *term_memory, RenderCtx *rc) { + Term *t = term_memory->memory; + DebugState *ds = term_memory->debug_memory; + if (!(t->gl.flags & DRAW_DEBUG_OVERLAY)) return; BEGIN_TIMED_BLOCK(); - DebugState *ds = t->debug_state; - v2 bar_chart_top_left = v2_from_iv2(t->gl.window_size); bar_chart_top_left.x *= 0.5; draw_debug_bar_chart(t, ds, rc, bar_chart_top_left, 0.25 * t->gl.window_size.w); diff --git a/debug.h b/debug.h @@ -158,8 +158,9 @@ static DebugTable g_debug_table; #define END_NAMED_BLOCK(name) RECORD_DEBUG_EVENT(__counter_##name, DE_END) +typedef struct TerminalMemory TerminalMemory; typedef struct Term Term; typedef struct RenderCtx RenderCtx; static void dump_lines_to_file(Term *t); -static void draw_debug_overlay(Term *t, RenderCtx *rc); +static void draw_debug_overlay(TerminalMemory *memory, RenderCtx *rc); #endif diff --git a/util.h b/util.h @@ -484,8 +484,6 @@ typedef struct Term { char saved_title[1024]; Stream error_stream; - - DebugState *debug_state; } Term; static f32 dt_for_frame; diff --git a/vtgl.c b/vtgl.c @@ -613,7 +613,9 @@ key_callback(GLFWwindow *win, i32 key, i32 sc, i32 act, i32 mods) return; } if (key == GLFW_KEY_F11 && act == GLFW_PRESS) { - t->debug_state->paused = !t->debug_state->paused; + /* TODO: probably move this into the debug frame start */ + DebugState *ds = ctx->memory->debug_memory; + ds->paused = !ds->paused; return; } if (key == GLFW_KEY_F12 && act == GLFW_PRESS) { @@ -1041,7 +1043,7 @@ DEBUG_EXPORT VTGL_FRAME_STEP_FN(vtgl_frame_step) * processing/effects shader */ BEGIN_NAMED_BLOCK(debug_overlay); glUseProgram(t->gl.programs[SHADER_RECTS]); - draw_debug_overlay(t, &rc); + draw_debug_overlay(memory, &rc); flush_render_push_buffer(&rc); END_NAMED_BLOCK(debug_overlay);