sketch out msg processing loop, to replace cmd processing loop, in dbg engine

This commit is contained in:
Ryan Fleury
2024-08-30 17:52:45 -07:00
parent 8770a43678
commit 7004994b25
10 changed files with 1018 additions and 26 deletions
+2 -1
View File
@@ -112,7 +112,8 @@ DF_MsgKindTable:
@enum DF_MsgKind:
{
@expand(DF_MsgKindTable a) `$(a.name)`
@expand(DF_MsgKindTable a) `$(a.name)`,
COUNT
}
@data(String8) df_msg_kind_name_lower_table:
+22 -3
View File
@@ -7809,6 +7809,19 @@ df_request_frame(void)
df_state->num_frames_requested = 4;
}
////////////////////////////////
//~ rjf: Message Functions
internal void
df_msg_(DF_MsgKind kind, D_Regs *regs)
{
DF_MsgNode *n = push_array(df_state->msgs_arena, DF_MsgNode, 1);
SLLQueuePush(df_state->msgs.first, df_state->msgs.last, n);
df_state->msgs.count += 1;
n->v.kind = kind;
n->v.regs = d_regs_copy(df_state->msgs_arena, regs);
}
////////////////////////////////
//~ rjf: Main Layer Top-Level Calls
@@ -10601,9 +10614,12 @@ df_end_frame(void)
}
internal void
df_frame(Arena *arena, D_CmdList *cmds)
df_frame(D_CmdList *cmds, F32 dt)
{
df_begin_frame(arena, cmds);
Temp scratch = scratch_begin(0, 0);
DI_Scope *di_scope = di_scope_open();
d_tick(scratch.arena, di_scope, cmds, dt);
df_begin_frame(scratch.arena, cmds);
{
B32 queue_drag_drop = 0;
if(queue_drag_drop)
@@ -10620,7 +10636,7 @@ df_frame(Arena *arena, D_CmdList *cmds)
}
d_push_regs();
d_regs()->window = df_handle_from_window(w);
df_window_update_and_render(arena, w, cmds);
df_window_update_and_render(scratch.arena, w, cmds);
D_Regs *window_regs = d_pop_regs();
if(df_window_from_handle(last_focused_window) == w)
{
@@ -10644,4 +10660,7 @@ df_frame(Arena *arena, D_CmdList *cmds)
}
r_end_frame();
}
di_scope_close(di_scope);
scratch_end(scratch);
}
+37 -2
View File
@@ -365,6 +365,31 @@ struct DF_ViewRuleSpec
#include "generated/dbg_frontend.meta.h"
////////////////////////////////
//~ rjf: Message Types
typedef struct DF_Msg DF_Msg;
struct DF_Msg
{
DF_MsgKind kind;
D_Regs *regs;
};
typedef struct DF_MsgNode DF_MsgNode;
struct DF_MsgNode
{
DF_MsgNode *next;
DF_Msg v;
};
typedef struct DF_MsgList DF_MsgList;
struct DF_MsgList
{
DF_MsgNode *first;
DF_MsgNode *last;
U64 count;
};
////////////////////////////////
//~ rjf: Theme Types
@@ -583,6 +608,10 @@ struct DF_State
// rjf: arenas
Arena *arena;
// rjf: messages
Arena *msgs_arena;
DF_MsgList msgs;
// rjf: frame request state
U64 num_frames_requested;
@@ -922,7 +951,13 @@ internal void df_request_frame(void);
////////////////////////////////
//~ rjf: Message Functions
internal void df_msg_(DF_MsgKind kind, D_Regs *regs);
#define df_msg(kind, ...) df_msg_((kind),\
&(D_Regs)\
{\
d_regs_lit_init_top\
__VA_ARGS__\
})
////////////////////////////////
//~ rjf: Main Layer Top-Level Calls
@@ -930,6 +965,6 @@ internal void df_request_frame(void);
internal void df_init(OS_WindowRepaintFunctionType *window_repaint_entry_point, D_StateDeltaHistory *hist);
internal void df_begin_frame(Arena *arena, D_CmdList *cmds);
internal void df_end_frame(void);
internal void df_frame(Arena *arena, D_CmdList *cmds);
internal void df_frame(D_CmdList *cmds, F32 dt);
#endif // DBG_FRONTEND_CORE_H
@@ -69,6 +69,7 @@ DF_MsgKind_FindThread,
DF_MsgKind_FindSelectedThread,
DF_MsgKind_GoToName,
DF_MsgKind_FindCodeLocation,
DF_MsgKind_COUNT,
} DF_MsgKind;
typedef enum DF_IconKind