eval space generation, to gracefully mark cached evaluations as dirty when desired

This commit is contained in:
Ryan Fleury
2025-04-26 12:33:48 -07:00
parent ea18e58903
commit 2092f5ca69
13 changed files with 248 additions and 438 deletions
+1 -1
View File
@@ -379,7 +379,7 @@ RD_NameSchemaInfo rd_name_schema_info_table[21] =
{str8_lit_comp("window"), str8_lit_comp("x:\n{\n //- rjf: text rasterization settings\n @default(1) @display_name('Smooth UI Text') @description(\"Controls whether or not UI text is fully anti-aliased, for a smoother appearance.\")\n 'smooth_ui_text': bool,\n @default(1) @display_name('Hint UI Text') @description(\"Controls whether or not UI text is hinted, for better text readability at small sizes.\")\n 'hint_ui_text': bool,\n @default(0) @display_name('Smooth Code Text') @description(\"Controls whether or not code text is fully anti-aliased, for a smoother appearance.\")\n 'smooth_code_text': bool,\n @default(1) @display_name('Hint Code Text') @description(\"Controls whether or not code text is hinted, for better text readability at small sizes.\")\n 'hint_code_text': bool,\n @default(11) @display_name('Window Font Size') @description(\"Controls the window's default font size. Does not apply to tabs with their own font size set.\")\n 'font_size': @range[6, 72] u64,\n\n //- rjf: size settings\n @default(3.f) @display_name('Window Row Height') @description(\"Controls the window's default row height, in multiples of the font size. Does not apply to tabs with their own row height set.\")\n 'row_height': @range[1.75f, 5.f] f32,\n @default(3.f) @description(\"Controls the height of tabs, in multiples of the font size.\")\n 'tab_height': @range[1.75f, 5.f] f32,\n}\n")},
{str8_lit_comp("tab"), str8_lit_comp("x:\n{\n @default(11) @display_name('Tab Font Size') @description(\"Controls the tab's font size.\")\n 'font_size': @range[6, 72] u64,\n}\n")},
{str8_lit_comp("watch"), str8_lit_comp("@inherit(tab) x:\n{\n @default(3.f) @display_name('Tab Row Height') @description(\"Controls the tab's row height, in multiples of the font size.\")\n 'row_height': @range[1.75f, 5.f] f32,\n 'label': code_string,\n @description(\"The root expression which is evaluated to produce the watch window.\")\n 'expression': code_string,\n @no_expand 'watches': query,\n}\n")},
{str8_lit_comp("text"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"The language that the text should be interpreted as being within. Used for syntax highlighting and other parsing features.\")\n 'lang': lang,\n @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers':bool,\n @default(0) @display_name('Transient') @description(\"Controls whether or not this tab will be automatically replaced by the debugger when it snaps to new source code locations.\")\n 'auto': bool,\n @description(\"An expression to describe data which should be viewed as text or code.\")\n 'expression': code_string,\n}\n")},
{str8_lit_comp("text"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe data which should be viewed as text or code.\")\n 'expression': code_string,\n @description(\"The language that the text should be interpreted as being within. Used for syntax highlighting and other parsing features.\")\n 'lang': lang,\n @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers':bool,\n @default(0) @display_name('Transient') @description(\"Controls whether or not this tab will be automatically replaced by the debugger when it snaps to new source code locations.\")\n 'auto': bool,\n}\n")},
{str8_lit_comp("disasm"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe the base address or offset of the disassembly.\")\n 'expression': code_string,\n 'arch': arch,\n 'syntax': dasm_syntax,\n 'size': code_string,\n @default(1) @description(\"Controls whether or not addresses are shown in the disassembly text.\")\n 'show_addresses': bool,\n @default(0) @description(\"Controls whether or not code bytes are shown in the disassembly text.\")\n 'show_code_bytes': bool,\n @default(1) @description(\"Controls whether or not source lines, corresponding to disassembly instruction ranges, are shown in the disassembly text.\")\n 'show_source_lines': bool,\n @default(1) @description(\"Controls whether or not disassembly text is decorated with symbol names.\")\n 'show_symbol_names': bool,\n @default(1) @description(\"Controls whether or not line numbers are shown.\")\n 'show_line_numbers': bool,\n}\n")},
{str8_lit_comp("memory"), str8_lit_comp("@inherit(tab) x:\n{\n @description(\"An expression to describe the base address or offset of the memory view.\")\n 'expression': code_string,\n @description(\"The number of bytes of the viewed memory range.\")\n 'size': code_string,\n @default(16) @description(\"The number of columns to build before building new rows.\")\n 'num_columns': @range[1, 64] u64,\n @default(1) @description(\"The number of bytes that each cell should represent.\")\n 'bytes_per_cell': @range[1, 8] u64,\n}\n")},
{str8_lit_comp("bitmap"), str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Base Pointer\") @description(\"An expression to describe the base address or offset of the bitmap data.\")\n 'expression': code_string,\n @order(0) 'w': u64,\n @order(1) 'h': u64,\n @display_name(\"Bitmap Format\") @description(\"The pixel format that the bitmap data should be interpreted as being within.\")\n 'fmt': tex2dformat,\n}\n")},
+2 -2
View File
@@ -327,14 +327,14 @@ RD_VocabTable:
```
@inherit(tab) x:
{
@description("An expression to describe data which should be viewed as text or code.")
'expression': code_string,
@description("The language that the text should be interpreted as being within. Used for syntax highlighting and other parsing features.")
'lang': lang,
@default(1) @description("Controls whether or not line numbers are shown.")
'show_line_numbers':bool,
@default(0) @display_name('Transient') @description("Controls whether or not this tab will be automatically replaced by the debugger when it snaps to new source code locations.")
'auto': bool,
@description("An expression to describe data which should be viewed as text or code.")
'expression': code_string,
}
```
}
+23 -1
View File
@@ -276,6 +276,8 @@ rd_name_release(String8 string)
internal RD_Cfg *
rd_cfg_alloc(void)
{
rd_state->cfg_change_gen += 1;
// rjf: allocate
RD_Cfg *result = rd_state->free_cfg;
{
@@ -318,6 +320,8 @@ rd_cfg_alloc(void)
internal void
rd_cfg_release(RD_Cfg *cfg)
{
rd_state->cfg_change_gen += 1;
Temp scratch = scratch_begin(0, 0);
// rjf: unhook from context
@@ -1561,6 +1565,21 @@ rd_cmd_name_from_eval(E_Eval eval)
//- rjf: eval space reads/writes
internal U64
rd_eval_space_gen(void *u, E_Space space)
{
U64 result = 0;
switch(space.kind)
{
case RD_EvalSpaceKind_MetaCfg:
case RD_EvalSpaceKind_MetaQuery:
{
result = rd_state->cfg_change_gen;
}break;
}
return result;
}
internal B32
rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range)
{
@@ -2820,6 +2839,7 @@ rd_view_ui(Rng2F32 rect)
//
if(state_dirty) ProfScope("state -> viz blocks")
{
eval = e_eval_from_string(eval.string);
MemoryZeroStruct(&block_tree);
MemoryZeroStruct(&block_ranges);
if(implicit_root || is_first_frame)
@@ -11669,7 +11689,7 @@ rd_frame(void)
}
//- rjf: try menu bar operations
if(rd_setting_b32_from_name(str8_lit("focus_menu_bar_with_alt")))
if(rd_state->alt_menu_bar_enabled)
{
if(!take && event->kind == OS_EventKind_Press && event->key == OS_Key_Alt && event->modifiers == 0 && event->is_repeat == 0)
{
@@ -11836,6 +11856,7 @@ rd_frame(void)
ctx->primary_module = eval_modules_primary;
//- rjf: fill space hooks
ctx->space_gen = rd_eval_space_gen;
ctx->space_read = rd_eval_space_read;
ctx->space_write = rd_eval_space_write;
}
@@ -12518,6 +12539,7 @@ rd_frame(void)
////////////////////////////
//- rjf: process top-level graphical commands
//
rd_state->alt_menu_bar_enabled = rd_setting_b32_from_name(str8_lit("focus_menu_bar_with_alt"));
if(rd_state->frame_depth == 0)
{
for(;rd_next_cmd(&cmd);) RD_RegsScope()
+3
View File
@@ -599,6 +599,7 @@ struct RD_State
Arena *arena;
B32 quit;
B32 quit_after_success;
B32 alt_menu_bar_enabled;
S32 frame_depth;
U64 frame_eval_memread_endt_us;
@@ -715,6 +716,7 @@ struct RD_State
U64 cfg_id_gen;
RD_CfgID cfg_last_accessed_id;
RD_Cfg *cfg_last_accessed;
U64 cfg_change_gen;
// rjf: window state cache
U64 window_state_slots_count;
@@ -923,6 +925,7 @@ internal E_Space rd_eval_space_from_ctrl_entity(CTRL_Entity *entity, E_SpaceKind
internal String8 rd_cmd_name_from_eval(E_Eval eval);
//- rjf: eval space reads/writes
internal U64 rd_eval_space_gen(void *u, E_Space space);
internal B32 rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range);
internal B32 rd_eval_space_write(void *u, E_Space space, void *in, Rng1U64 range);
+1
View File
@@ -257,6 +257,7 @@ E_TYPE_ACCESS_FUNCTION_DEF(schema)
{
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), child->first->string.size, E_TypeFlag_IsPathText);
}
else if(str8_match(child_schema->first->string, str8_lit("string"), 0))
{
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), child->first->string.size, E_TypeFlag_IsPlainText);