vtgl

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

Commit: 26e708a0acd69e6e7c9ecfe1ed0a0feb27251105
Parent: 9e33e5cc236b2fbfc78f504ef577249484fd0b0b
Author: Randy Palamar
Date:   Fri,  6 Dec 2024 20:40:21 -0700

move debug_frame_end to the start of the frame

this gives a chance for a frame to render and should fix the bug
of running out of debug event storage after a period of inactivity.

Diffstat:
Mdebug.c | 4+++-
Mdebug.h | 2+-
Mplatform_linux_amd64.c | 1-
Mvtgl.c | 10++++------
4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/debug.c b/debug.c @@ -384,7 +384,7 @@ debug_init(TerminalMemory *memory) } static void -debug_frame_end(TerminalMemory *memory) +debug_frame_end(TerminalMemory *memory, TerminalInput *input) { DebugState *debug_state = memory->debug_memory; if (!debug_state->initialized) @@ -396,6 +396,8 @@ debug_frame_end(TerminalMemory *memory) u64 event_array_event_index = atomic_exchange_n(&g_debug_table.event_array_event_index, (u64)g_debug_table.snapshot_index << 32); + FRAME_MARK(input->dt); + u32 array_index = event_array_event_index >> 32; u32 event_count = event_array_event_index & 0xFFFFFFFF; diff --git a/debug.h b/debug.h @@ -144,6 +144,6 @@ static DebugTable g_debug_table; static void dump_lines_to_file(Term *t); static void draw_debug_overlay(TerminalMemory *term_memory, TerminalInput *input, RenderCtx *rc); -static void debug_frame_end(TerminalMemory *memory); +static void debug_frame_end(TerminalMemory *memory, TerminalInput *input); #endif diff --git a/platform_linux_amd64.c b/platform_linux_amd64.c @@ -1,5 +1,4 @@ /* See LICENSE for license details. */ - #ifndef asm #ifdef __asm #define asm __asm diff --git a/vtgl.c b/vtgl.c @@ -1229,8 +1229,6 @@ DEBUG_EXPORT VTGL_ACTIVE_SELECTION_FN(vtgl_active_selection) DEBUG_EXPORT VTGL_RENDER_FRAME_FN(vtgl_render_frame) { - FRAME_MARK(input->dt); - BEGIN_TIMED_BLOCK(); Term *t = memory->memory; @@ -1320,6 +1318,10 @@ DEBUG_EXPORT VTGL_RENDER_FRAME_FN(vtgl_render_frame) DEBUG_EXPORT VTGL_FRAME_STEP_FN(vtgl_frame_step) { + BEGIN_NAMED_BLOCK(debug_end_frame); + debug_frame_end(memory, input); + END_NAMED_BLOCK(debug_end_frame); + BEGIN_TIMED_BLOCK(); Term *t = memory->memory; @@ -1376,10 +1378,6 @@ DEBUG_EXPORT VTGL_FRAME_STEP_FN(vtgl_frame_step) end_temp_arena(t->temp_arena); - BEGIN_NAMED_BLOCK(debug_end_frame); - debug_frame_end(memory); - END_NAMED_BLOCK(debug_end_frame); - END_TIMED_BLOCK(); return t->gl.queued_render || input->window_refreshed || t->gl.flags & DRAW_DEBUG_OVERLAY;