finish trimming old view rule code; get 3d geometry viewer back in good shape and integrated as a full view

This commit is contained in:
Ryan Fleury
2024-08-28 11:36:44 -07:00
parent 5ff9e47f8a
commit 22c4336375
16 changed files with 293 additions and 378 deletions
+21 -21
View File
@@ -520,27 +520,27 @@ DF_CoreCmdTable:// | | | |
@table(coverage_check name name_lower string ih ex xp vb display_name docs schema description)
DF_CoreViewRuleTable:
{
{x Default default "default" - - - x "Default" - "" "" }
{x Array array "array" - - x - "Array" x "x:{expr}" "Specifies that a pointer points to N elements, rather than only 1." }
{x Slice slice "slice" - - x - "Slice" x "" "Specifies that a pointer within a struct, also containing an integer, points to the number of elements encoded by the integer." }
{- List list "list" - - - x "List" x "x:{member}" "Specifies that some struct, union, or class forms the top of a linked list, and the member which points at the following element in the list." }
{x ByteSwap bswap "bswap" x - x - "Byte Swap" x "" "Specifies that all integral evaluations should be byte-swapped, such that their endianness is reversed." }
{x Cast cast "cast" - - x - "Cast" x "x:{type}" "Specifies that the expression to which the view rule is applied should be casted to the provided type." }
{- BaseDec base_dec "dec" x - - - "Decimal Base (Base 10)" x "" "Specifies that all integral evaluations should appear in base-10 form." }
{- BaseBin base_bin "bin" x - - - "Binary Base (Base 2)" x "" "Specifies that all integral evaluations should appear in base-2 form." }
{- BaseOct base_oct "oct" x - - - "Octal Base (Base 8)" x "" "Specifies that all integral evaluations should appear in base-8 form." }
{- BaseHex base_hex "hex" x - - - "Hexadecimal Base (Base 16)" x "" "Specifies that all integral evaluations should appear in base-16 form." }
{- Only only "only" x - - x "Only Specified Members" x "x:{member}" "Specifies that only the specified members should appear in struct, union, or class evaluations." }
{- Omit omit "omit" x - - x "Omit Specified Members" x "x:{member}" "Omits a list of member names from appearing in struct, union, or class evaluations." }
{- NoAddr no_addr "no_addr" x - - - "Disable Address Values" x "" "Displays only what pointers point to, if possible, without the pointer's address value." }
{x Checkbox checkbox "checkbox" - - - - "Checkbox" x "" "Displays simple integer values as checkboxes, encoding zero or nonzero values." }
{- RGBA rgba "rgba" - x - x "Color (RGBA)" x "" "Displays as a color, interpreting the data as encoding R, G, B, and A values." }
{x Text text "text" - x - x "Text" x "x:{'lang':lang, 'size':expr}" "Displays as text." }
{x Disasm disasm "disasm" - x - x "Disassembly" x "x:{'arch':arch, 'size':expr}" "Displays as disassembled instructions, interpreting the data as raw machine code." }
{x Memory memory "memory" - x - x "Memory" x "x:{'size':expr}" "Displays as a raw memory grid." }
{- Graph graph "graph" - x - x "Graph" x "" "Displays as a pointer graph, visualizing nodes and edges formed by pointers directly." }
{x Bitmap bitmap "bitmap" - x - x "Bitmap" x "x:{'w':expr, 'h':expr, 'fmt':tex2dformat}" "Displays as a bitmap, interpreting the data as raw pixel data." }
{- Geo geo "geo" - x - x "Geometry" x "x:{'count':expr, 'vertices_base':expr, 'vertices_size':expr}" "Displays as geometry, interpreting the data as vertex data." }
{x Default default "default" - - - x "Default" - "" "" }
{x Array array "array" - - x - "Array" x "x:{expr}" "Specifies that a pointer points to N elements, rather than only 1." }
{x Slice slice "slice" - - x - "Slice" x "" "Specifies that a pointer within a struct, also containing an integer, points to the number of elements encoded by the integer." }
{- List list "list" - - - x "List" x "x:{member}" "Specifies that some struct, union, or class forms the top of a linked list, and the member which points at the following element in the list." }
{x ByteSwap bswap "bswap" x - x - "Byte Swap" x "" "Specifies that all integral evaluations should be byte-swapped, such that their endianness is reversed." }
{x Cast cast "cast" - - x - "Cast" x "x:{type}" "Specifies that the expression to which the view rule is applied should be casted to the provided type." }
{- BaseDec base_dec "dec" x - - - "Decimal Base (Base 10)" x "" "Specifies that all integral evaluations should appear in base-10 form." }
{- BaseBin base_bin "bin" x - - - "Binary Base (Base 2)" x "" "Specifies that all integral evaluations should appear in base-2 form." }
{- BaseOct base_oct "oct" x - - - "Octal Base (Base 8)" x "" "Specifies that all integral evaluations should appear in base-8 form." }
{- BaseHex base_hex "hex" x - - - "Hexadecimal Base (Base 16)" x "" "Specifies that all integral evaluations should appear in base-16 form." }
{- Only only "only" x - - x "Only Specified Members" x "x:{member}" "Specifies that only the specified members should appear in struct, union, or class evaluations." }
{- Omit omit "omit" x - - x "Omit Specified Members" x "x:{member}" "Omits a list of member names from appearing in struct, union, or class evaluations." }
{- NoAddr no_addr "no_addr" x - - - "Disable Address Values" x "" "Displays only what pointers point to, if possible, without the pointer's address value." }
{x Checkbox checkbox "checkbox" - - - - "Checkbox" x "" "Displays simple integer values as checkboxes, encoding zero or nonzero values." }
{- RGBA rgba "rgba" - x - x "Color (RGBA)" x "" "Displays as a color, interpreting the data as encoding R, G, B, and A values." }
{x Text text "text" - x - x "Text" x "x:{'lang':lang, 'size':expr}" "Displays as text." }
{x Disasm disasm "disasm" - x - x "Disassembly" x "x:{'arch':arch, 'size':expr}" "Displays as disassembled instructions, interpreting the data as raw machine code." }
{x Memory memory "memory" - x - x "Memory" x "x:{'size':expr}" "Displays as a raw memory grid." }
{- Graph graph "graph" - x - x "Graph" x "" "Displays as a pointer graph, visualizing nodes and edges formed by pointers directly." }
{x Bitmap bitmap "bitmap" - x - x "Bitmap" x "x:{'w':expr, 'h':expr, 'fmt':tex2dformat}" "Displays as a bitmap, interpreting the data as raw pixel data." }
{- Geo3D geo3d "geo3d" - x - x "Geometry (3D)" x "x:{'count':expr, 'vtx':expr, 'vtx_size':expr}" "Displays as geometry, interpreting the data as index or vertex data." }
}
////////////////////////////////
+1 -1
View File
@@ -503,7 +503,7 @@ DF_CoreViewRuleSpecInfo df_g_core_view_rule_spec_info_table[21] =
{str8_lit_comp("memory"), str8_lit_comp("Memory"), str8_lit_comp("x:{'size':expr}"), str8_lit_comp("Displays as a raw memory grid."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(memory) , },
{str8_lit_comp("graph"), str8_lit_comp("Graph"), str8_lit_comp(""), str8_lit_comp("Displays as a pointer graph, visualizing nodes and edges formed by pointers directly."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(graph) , },
{str8_lit_comp("bitmap"), str8_lit_comp("Bitmap"), str8_lit_comp("x:{'w':expr, 'h':expr, 'fmt':tex2dformat}"), str8_lit_comp("Displays as a bitmap, interpreting the data as raw pixel data."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(bitmap) , },
{str8_lit_comp("geo"), str8_lit_comp("Geometry"), str8_lit_comp("x:{'count':expr, 'vertices_base':expr, 'vertices_size':expr}"), str8_lit_comp("Displays as geometry, interpreting the data as vertex data."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(geo) , },
{str8_lit_comp("geo3d"), str8_lit_comp("Geometry (3D)"), str8_lit_comp("x:{'count':expr, 'vtx':expr, 'vtx_size':expr}"), str8_lit_comp("Displays as geometry, interpreting the data as index or vertex data."), (DF_CoreViewRuleSpecInfoFlag_Inherited*0)|(DF_CoreViewRuleSpecInfoFlag_Expandable*1)|(DF_CoreViewRuleSpecInfoFlag_ExprResolution*0)|(DF_CoreViewRuleSpecInfoFlag_VizBlockProd*1), 0, DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(geo3d) , },
};
String8 df_g_icon_kind_text_table[69] =
+2 -2
View File
@@ -370,7 +370,7 @@ DF_CoreViewRuleKind_Disasm,
DF_CoreViewRuleKind_Memory,
DF_CoreViewRuleKind_Graph,
DF_CoreViewRuleKind_Bitmap,
DF_CoreViewRuleKind_Geo,
DF_CoreViewRuleKind_Geo3D,
DF_CoreViewRuleKind_COUNT,
} DF_CoreViewRuleKind;
@@ -446,7 +446,7 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(disasm);
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(memory);
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(graph);
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(bitmap);
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(geo);
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(geo3d);
global B32 DEV_telemetry_capture = 0;
global B32 DEV_simulate_lag = 0;
global B32 DEV_draw_ui_text_pos = 0;
+50 -46
View File
@@ -846,48 +846,52 @@ df_view_equip_spec(DF_Window *window, DF_View *view, DF_ViewSpec *spec, String8
arena_clear(view->params_arenas[idx]);
}
view->params_roots[0] = md_tree_copy(view->params_arenas[0], params);
view->params_write_gen = view->params_read_gen = 0;
// rjf: fill query buffer
df_view_equip_query(view, query);
// rjf: initialize state for new view spec
DF_ViewSetupFunctionType *view_setup = spec->info.setup_hook;
{
for(DF_ArenaExt *ext = view->first_arena_ext; ext != 0; ext = ext->next)
{
arena_release(ext->arena);
}
for(DF_View *tchild = view->first_transient, *next = 0; !df_view_is_nil(tchild); tchild = next)
{
next = tchild->order_next;
df_view_release(tchild);
}
view->first_transient = view->last_transient = &df_g_nil_view;
view->first_arena_ext = view->last_arena_ext = 0;
view->transient_view_slots_count = 0;
view->transient_view_slots = 0;
arena_clear(view->arena);
view->user_data = 0;
}
MemoryZeroStruct(&view->scroll_pos);
view->spec = spec;
if(spec->info.flags & DF_ViewSpecFlag_ProjectSpecific)
{
arena_clear(view->project_path_arena);
view->project_path = push_str8_copy(view->project_path_arena, df_cfg_path_from_src(DF_CfgSrc_Project));
}
else
{
MemoryZeroStruct(&view->project_path);
}
view->is_filtering = 0;
view->is_filtering_t = 0;
view_setup(window, view, view->params_roots[view->params_read_gen%ArrayCount(view->params_roots)], str8(view->query_buffer, view->query_string_size));
}
internal void
df_view_equip_query(DF_View *view, String8 query)
{
view->query_string_size = Min(sizeof(view->query_buffer), query.size);
MemoryCopy(view->query_buffer, query.str, view->query_string_size);
view->query_cursor = view->query_mark = txt_pt(1, query.size+1);
// rjf: initialize state for new view spec, if needed
if(view->spec != spec || spec == &df_g_nil_view_spec)
{
DF_ViewSetupFunctionType *view_setup = spec->info.setup_hook;
{
for(DF_ArenaExt *ext = view->first_arena_ext; ext != 0; ext = ext->next)
{
arena_release(ext->arena);
}
for(DF_View *tchild = view->first_transient, *next = 0; !df_view_is_nil(tchild); tchild = next)
{
next = tchild->order_next;
df_view_release(tchild);
}
view->first_transient = view->last_transient = &df_g_nil_view;
view->first_arena_ext = view->last_arena_ext = 0;
view->transient_view_slots_count = 0;
view->transient_view_slots = 0;
arena_clear(view->arena);
view->user_data = 0;
}
MemoryZeroStruct(&view->scroll_pos);
view->spec = spec;
if(spec->info.flags & DF_ViewSpecFlag_ProjectSpecific)
{
arena_clear(view->project_path_arena);
view->project_path = push_str8_copy(view->project_path_arena, df_cfg_path_from_src(DF_CfgSrc_Project));
}
else
{
MemoryZeroStruct(&view->project_path);
}
view->is_filtering = 0;
view->is_filtering_t = 0;
view_setup(window, view, view->params_roots[view->params_read_gen%ArrayCount(view->params_roots)], str8(view->query_buffer, view->query_string_size));
}
}
internal void
@@ -976,43 +980,43 @@ df_view_store_paramf(DF_View *view, String8 key, char *fmt, ...)
////////////////////////////////
//~ rjf: Expand-Keyed Transient View Functions
internal DF_View *
df_transient_view_from_expand_key(DF_View *owner_view, DF_ExpandKey key)
internal DF_TransientViewNode *
df_transient_view_node_from_expand_key(DF_View *owner_view, DF_ExpandKey key)
{
if(owner_view->transient_view_slots_count == 0)
{
owner_view->transient_view_slots_count = 256;
owner_view->transient_view_slots = push_array(owner_view->arena, DF_TransientViewSlot, owner_view->transient_view_slots_count);
}
DF_View *view = &df_g_nil_view;
U64 hash = df_hash_from_expand_key(key);
U64 slot_idx = hash%owner_view->transient_view_slots_count;
DF_TransientViewSlot *slot = &owner_view->transient_view_slots[slot_idx];
DF_TransientViewNode *node = 0;
for(DF_TransientViewNode *n = slot->first; n != 0; n = n->next)
{
if(df_expand_key_match(n->key, key))
{
view = n->view;
node = n;
n->last_frame_index_touched = df_frame_index();
break;
}
}
if(df_view_is_nil(view))
if(node == 0)
{
if(!owner_view->free_transient_view_node)
{
owner_view->free_transient_view_node = push_array(df_gfx_state->arena, DF_TransientViewNode, 1);
}
DF_TransientViewNode *node = owner_view->free_transient_view_node;
node = owner_view->free_transient_view_node;
SLLStackPop(owner_view->free_transient_view_node);
DLLPushBack(slot->first, slot->last, node);
node->key = key;
node->view = df_view_alloc();
node->initial_params_arena = arena_alloc();
node->first_frame_index_touched = node->last_frame_index_touched = df_frame_index();
view = node->view;
DLLPushBack_NPZ(&df_g_nil_view, owner_view->first_transient, owner_view->last_transient, view, order_next, order_prev);
DLLPushBack_NPZ(&df_g_nil_view, owner_view->first_transient, owner_view->last_transient, node->view, order_next, order_prev);
}
return view;
return node;
}
////////////////////////////////
+5 -2
View File
@@ -171,6 +171,8 @@ struct DF_TransientViewNode
DF_TransientViewNode *prev;
DF_ExpandKey key;
DF_View *view;
Arena *initial_params_arena;
MD_Node *initial_params;
U64 first_frame_index_touched;
U64 last_frame_index_touched;
};
@@ -347,7 +349,7 @@ enum
#define DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(name) df_gfx_view_rule_line_stringize__##name
#define DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(name) internal DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_SIG(DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(name))
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, DF_ExpandKey key, E_Eval eval, MD_Node *params)
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, DF_ExpandKey key, MD_Node *params, String8 string)
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(name) df_gfx_view_rule_row_ui__##name
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(name) DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(name))
@@ -962,6 +964,7 @@ internal void df_view_release(DF_View *view);
//- rjf: equipment
internal void df_view_equip_spec(DF_Window *window, DF_View *view, DF_ViewSpec *spec, String8 query, MD_Node *params);
internal void df_view_equip_query(DF_View *view, String8 query);
internal void df_view_equip_loading_info(DF_View *view, B32 is_loading, U64 progress_v, U64 progress_target);
//- rjf: user state extensions
@@ -979,7 +982,7 @@ internal void df_view_store_paramf(DF_View *view, String8 key, char *fmt, ...);
////////////////////////////////
//~ rjf: Expand-Keyed Transient View Functions
internal DF_View *df_transient_view_from_expand_key(DF_View *owner_view, DF_ExpandKey key);
internal DF_TransientViewNode *df_transient_view_node_from_expand_key(DF_View *owner_view, DF_ExpandKey key);
////////////////////////////////
//~ rjf: View Rule Instance State Functions
+2 -1
View File
@@ -257,6 +257,7 @@ DF_GfxViewTable:
{ Memory "memory" "Memory" Grid 0 0 1 0 1 0 1 "A hex-editor-like grid interface for viewing memory." }
{ Bitmap "bitmap" "Bitmap" Binoculars 0 0 1 0 1 0 1 "Visualizes memory as a bitmap." }
{ ColorRGBA "color_rgba" "Color (RGBA)" Palette 0 0 1 0 1 0 1 "Visualizes memory as an RGBA color." }
{ Geometry3D "geometry_3d" "Geometry (3D)" Binoculars 0 0 1 0 1 0 1 "Visualizes memory as 3D geometry." }
//- rjf: meta (settings)
{ ExceptionFilters "exception_filters" "Exception Filters" Gear 0 0 1 1 0 1 1 "An interface which controls whether or not the debugger will halt attached processes upon encountering specific exception codes for the first time." }
@@ -334,7 +335,7 @@ DF_GfxViewRuleTable:
{"disasm" - - - x "disassembly" }
{"memory" - - - x "memory" }
{"bitmap" - - - x "bitmap" }
{"geo" - - x x "geometry" }
{"geo3d" - - - x "geometry_3d" }
}
@gen
+7 -196
View File
@@ -335,11 +335,14 @@ DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(no_addr){}
DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(checkbox)
{
Temp scratch = scratch_begin(0, 0);
E_Eval eval = e_eval_from_string(scratch.arena, string);
E_Eval value_eval = e_value_eval_from_eval(eval);
if(ui_clicked(df_icon_buttonf(ws, value_eval.value.u64 == 0 ? DF_IconKind_CheckHollow : DF_IconKind_CheckFilled, 0, "###check")))
{
df_commit_eval_value_string(eval, value_eval.value.u64 == 0 ? str8_lit("1") : str8_lit("0"));
}
scratch_end(scratch);
}
////////////////////////////////
@@ -359,12 +362,8 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(rgba)
DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(rgba)
{
Temp scratch = scratch_begin(0, 0);
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
//- rjf: grab hsva
E_Eval value_eval = e_value_eval_from_eval(eval);
Vec4F32 rgba = df_rgba_from_eval_params(value_eval, params);
E_Eval eval = e_eval_from_string(scratch.arena, string);
Vec4F32 rgba = df_rgba_from_eval_params(eval, params);
Vec4F32 hsva = hsva_from_rgba(rgba);
//- rjf: build text box
@@ -490,90 +489,9 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(bitmap)
}
////////////////////////////////
//~ rjf: "geo"
//~ rjf: "geo3d"
#if 0
internal DF_GeoTopologyInfo
df_vr_geo_topology_info_from_cfg(DF_CfgNode *cfg)
{
Temp scratch = scratch_begin(0, 0);
DF_GeoTopologyInfo result = {0};
{
StringJoin join = {0};
join.sep = str8_lit(" ");
DF_CfgNode *count_cfg = df_cfg_node_child_from_string(cfg, str8_lit("count"), 0);
DF_CfgNode *vertices_base_cfg = df_cfg_node_child_from_string(cfg, str8_lit("vertices_base"), 0);
DF_CfgNode *vertices_size_cfg = df_cfg_node_child_from_string(cfg, str8_lit("vertices_size"), 0);
String8List count_expr_strs = {0};
String8List vertices_base_expr_strs = {0};
String8List vertices_size_expr_strs = {0};
for(DF_CfgNode *child = count_cfg->first; child != &df_g_nil_cfg_node; child = child->next)
{
str8_list_push(scratch.arena, &count_expr_strs, child->string);
}
for(DF_CfgNode *child = vertices_base_cfg->first; child != &df_g_nil_cfg_node; child = child->next)
{
str8_list_push(scratch.arena, &vertices_base_expr_strs, child->string);
}
for(DF_CfgNode *child = vertices_size_cfg->first; child != &df_g_nil_cfg_node; child = child->next)
{
str8_list_push(scratch.arena, &vertices_size_expr_strs, child->string);
}
String8 count_expr = str8_list_join(scratch.arena, &count_expr_strs, &join);
String8 vertices_base_expr = str8_list_join(scratch.arena, &vertices_base_expr_strs, &join);
String8 vertices_size_expr = str8_list_join(scratch.arena, &vertices_size_expr_strs, &join);
E_Eval count_eval = e_eval_from_string(scratch.arena, count_expr);
E_Eval vertices_base_eval = e_eval_from_string(scratch.arena, vertices_base_expr);
E_Eval vertices_size_eval = e_eval_from_string(scratch.arena, vertices_size_expr);
E_Eval count_val_eval = e_value_eval_from_eval(count_eval);
E_Eval vertices_base_val_eval = e_value_eval_from_eval(vertices_base_eval);
E_Eval vertices_size_val_eval = e_value_eval_from_eval(vertices_size_eval);
U64 vertices_base_vaddr = vertices_base_val_eval.value.u64;
result.index_count = count_val_eval.value.u64;
result.vertices_vaddr_range = r1u64(vertices_base_vaddr, vertices_base_vaddr+vertices_size_val_eval.value.u64);
}
scratch_end(scratch);
return result;
}
#endif
internal UI_BOX_CUSTOM_DRAW(df_vr_geo_box_draw)
{
DF_VR_GeoBoxDrawData *draw_data = (DF_VR_GeoBoxDrawData *)user_data;
DF_VR_GeoState *state = df_view_rule_block_user_state(draw_data->key, DF_VR_GeoState);
// rjf: get clip
Rng2F32 clip = box->rect;
for(UI_Box *b = box->parent; !ui_box_is_nil(b); b = b->parent)
{
if(b->flags & UI_BoxFlag_Clip)
{
clip = intersect_2f32(b->rect, clip);
}
}
// rjf: calculate eye/target
Vec3F32 target = {0};
Vec3F32 eye = v3f32(state->zoom*cos_f32(state->yaw)*sin_f32(state->pitch),
state->zoom*sin_f32(state->yaw)*sin_f32(state->pitch),
state->zoom*cos_f32(state->pitch));
// rjf: mesh
Vec2F32 box_dim = dim_2f32(box->rect);
R_PassParams_Geo3D *pass = d_geo3d_begin(box->rect,
make_look_at_4x4f32(eye, target, v3f32(0, 0, 1)),
make_perspective_4x4f32(0.25f, box_dim.x/box_dim.y, 0.1f, 500.f));
pass->clip = clip;
d_mesh(draw_data->vertex_buffer, draw_data->index_buffer, R_GeoTopologyKind_Triangles, R_GeoVertexFlag_TexCoord|R_GeoVertexFlag_Normals|R_GeoVertexFlag_RGB, r_handle_zero(), mat_4x4f32(1.f));
// rjf: blur
if(draw_data->loaded_t < 0.98f)
{
d_blur(intersect_2f32(clip, box->rect), 10.f-9.f*draw_data->loaded_t, 0);
}
}
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(geo)
DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(geo3d)
{
DF_EvalVizBlock *vb = df_eval_viz_block_begin(arena, DF_EvalVizBlockKind_Canvas, key, df_expand_key_make(df_hash_from_expand_key(key), 1), depth);
vb->string = string;
@@ -583,110 +501,3 @@ DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(geo)
vb->cfg_table = cfg_table;
df_eval_viz_block_end(out, vb);
}
DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(geo)
{
E_Eval value_eval = e_value_eval_from_eval(eval);
U64 base_vaddr = value_eval.value.u64;
DF_Font(ws, DF_FontSlot_Code) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
ui_labelf("0x%I64x -> Geometry", base_vaddr);
}
#if 0
DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(geo)
{
Temp scratch = scratch_begin(0, 0);
GEO_Scope *geo_scope = geo_scope_open();
DF_VR_GeoState *state = df_view_rule_block_user_state(key, DF_VR_GeoState);
if(!state->initialized)
{
state->initialized = 1;
state->zoom_target = 3.5f;
state->yaw = state->yaw_target = -0.125f;
state->pitch = state->pitch_target = -0.125f;
}
if(state->last_open_frame_idx+1 < df_frame_index())
{
state->loaded_t = 0;
}
state->last_open_frame_idx = df_frame_index();
//- rjf: resolve to address value
E_Eval value_eval = e_value_eval_from_eval(eval);
U64 base_vaddr = value_eval.value.u64;
//- rjf: extract extra geo topology info from view rule
DF_GeoTopologyInfo top = df_vr_geo_topology_info_from_cfg(cfg);
Rng1U64 index_buffer_vaddr_range = r1u64(base_vaddr, base_vaddr+top.index_count*sizeof(U32));
Rng1U64 vertex_buffer_vaddr_range = top.vertices_vaddr_range;
//- rjf: unpack thread/process of eval
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
//- rjf: obtain keys for index buffer & vertex buffer memory
U128 index_buffer_key = ctrl_hash_store_key_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, index_buffer_vaddr_range, 0);
U128 vertex_buffer_key = ctrl_hash_store_key_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, vertex_buffer_vaddr_range, 0);
//- rjf: get gpu buffers
R_Handle index_buffer = geo_buffer_from_key(geo_scope, index_buffer_key);
R_Handle vertex_buffer = geo_buffer_from_key(geo_scope, vertex_buffer_key);
//- rjf: build preview
F32 rate = 1 - pow_f32(2, (-15.f * df_dt()));
if(top.index_count != 0)
{
UI_Padding(ui_pct(1.f, 0.f))
UI_PrefWidth(ui_px(dim.y, 1.f))
UI_Column UI_Padding(ui_pct(1.f, 0.f))
UI_PrefHeight(ui_px(dim.y, 1.f))
{
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground|UI_BoxFlag_Clickable, "geo_box");
UI_Signal sig = ui_signal_from_box(box);
if(ui_dragging(sig))
{
if(ui_pressed(sig))
{
Vec2F32 data = v2f32(state->yaw_target, state->pitch_target);
ui_store_drag_struct(&data);
}
Vec2F32 drag_delta = ui_drag_delta();
Vec2F32 drag_start_data = *ui_get_drag_struct(Vec2F32);
state->yaw_target = drag_start_data.x + drag_delta.x/dim_2f32(box->rect).x;
state->pitch_target = drag_start_data.y + drag_delta.y/dim_2f32(box->rect).y;
}
state->zoom += (state->zoom_target - state->zoom) * rate;
state->yaw += (state->yaw_target - state->yaw) * rate;
state->pitch += (state->pitch_target - state->pitch) * rate;
if(abs_f32(state->zoom-state->zoom_target) > 0.001f ||
abs_f32(state->yaw-state->yaw_target) > 0.001f ||
abs_f32(state->pitch-state->pitch_target) > 0.001f)
{
df_gfx_request_frame();
}
DF_VR_GeoBoxDrawData *draw_data = push_array(ui_build_arena(), DF_VR_GeoBoxDrawData, 1);
draw_data->key = key;
draw_data->vertex_buffer = vertex_buffer;
draw_data->index_buffer = index_buffer;
draw_data->loaded_t = state->loaded_t;
ui_box_equip_custom_draw(box, df_vr_geo_box_draw, draw_data);
if(r_handle_match(r_handle_zero(), vertex_buffer))
{
df_gfx_request_frame();
state->loaded_t = 0;
}
else
{
state->loaded_t += (1.f - state->loaded_t) * rate;
if(state->loaded_t < 0.99f)
{
df_gfx_request_frame();
}
}
}
}
geo_scope_close(geo_scope);
scratch_end(scratch);
}
#endif
-70
View File
@@ -4,74 +4,4 @@
#ifndef DF_VIEW_RULES_H
#define DF_VIEW_RULES_H
////////////////////////////////
//~ rjf: "rgba"
typedef struct DF_VR_RGBAState DF_VR_RGBAState;
struct DF_VR_RGBAState
{
Vec4F32 hsva;
U64 memgen_idx;
};
internal void df_vr_eval_commit_rgba(E_Eval eval, Vec4F32 rgba);
////////////////////////////////
//~ rjf: "disasm"
typedef struct DF_DisasmTopologyInfo DF_DisasmTopologyInfo;
struct DF_DisasmTopologyInfo
{
Architecture arch;
U64 size_cap;
};
typedef struct DF_VR_DisasmState DF_VR_DisasmState;
struct DF_VR_DisasmState
{
B32 initialized;
TxtPt cursor;
TxtPt mark;
S64 preferred_column;
U64 last_open_frame_idx;
F32 loaded_t;
};
////////////////////////////////
//~ rjf: "geo"
typedef struct DF_GeoTopologyInfo DF_GeoTopologyInfo;
struct DF_GeoTopologyInfo
{
U64 index_count;
Rng1U64 vertices_vaddr_range;
};
typedef struct DF_VR_GeoState DF_VR_GeoState;
struct DF_VR_GeoState
{
B32 initialized;
U64 last_open_frame_idx;
F32 loaded_t;
F32 pitch;
F32 pitch_target;
F32 yaw;
F32 yaw_target;
F32 zoom;
F32 zoom_target;
};
typedef struct DF_VR_GeoBoxDrawData DF_VR_GeoBoxDrawData;
struct DF_VR_GeoBoxDrawData
{
DF_ExpandKey key;
R_Handle vertex_buffer;
R_Handle index_buffer;
F32 loaded_t;
};
#if 0
internal DF_GeoTopologyInfo df_vr_geo_topology_info_from_cfg(DF_CfgNode *cfg);
#endif
#endif // DF_VIEW_RULES_H
+165 -30
View File
@@ -2709,33 +2709,15 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
//- rjf: unpack
DF_WatchViewPoint pt = {0, row->parent_key, row->key};
DF_ViewSpec *canvas_view_spec = df_view_spec_from_string(row->expand_ui_rule_spec->info.view_spec_name);
DF_View *canvas_view = df_transient_view_from_expand_key(view, row->key);
DF_TransientViewNode *canvas_view_node = df_transient_view_node_from_expand_key(view, row->key);
DF_View *canvas_view = canvas_view_node->view;
String8 canvas_view_expr = e_string_from_expr(scratch.arena, row->expr);
B32 need_new_spec = 0;
if(!need_new_spec && !str8_match(str8(canvas_view->query_buffer, canvas_view->query_string_size), canvas_view_expr, 0))
{
need_new_spec = 1;
}
if(!need_new_spec)
{
for(MD_EachNode(child, row->expand_ui_rule_params->first))
{
MD_Node *current_param = md_child_from_string(canvas_view->params_roots[canvas_view->params_write_gen%ArrayCount(canvas_view->params_roots)],
child->string, 0);
if(md_node_is_nil(current_param))
{
need_new_spec = 1;
break;
}
else if(!md_node_deep_match(child, current_param, 0))
{
need_new_spec = 1;
break;
}
}
}
B32 need_new_spec = (!str8_match(str8(canvas_view->query_buffer, canvas_view->query_string_size), canvas_view_expr, 0) ||
!md_tree_match(canvas_view_node->initial_params, row->expand_ui_rule_params, 0));
if(need_new_spec)
{
arena_clear(canvas_view_node->initial_params_arena);
canvas_view_node->initial_params = md_tree_copy(canvas_view_node->initial_params_arena, row->expand_ui_rule_params);
df_view_equip_spec(ws, canvas_view, canvas_view_spec, canvas_view_expr, row->expand_ui_rule_params);
}
Vec2F32 canvas_dim = v2f32(scroll_list_params.dim_px.x - ui_top_font_size()*1.5f,
@@ -3019,7 +3001,8 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_Clickable, "###val_%I64x", row_hash);
UI_Parent(box)
{
cell_ui_hook(ws, row->key, cell_eval, cell_ui_params);
String8 row_expr = e_string_from_expr(scratch.arena, row->expr);
cell_ui_hook(ws, row->key, cell_ui_params, row_expr);
}
sig = ui_signal_from_box(box);
}
@@ -3896,7 +3879,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
if(query_normalized_with_opt_slash_props.flags & FilePropertyFlag_IsFolder)
{
String8 new_path = push_str8f(scratch.arena, "%S%S/", path_query.path, path_query.search);
df_view_equip_spec(ws, view, view->spec, new_path, &md_nil_node);
df_view_equip_query(view, new_path);
}
// rjf: is a file -> complete view
@@ -3926,7 +3909,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
{
String8 existing_path = str8_chop_last_slash(path_query.path);
String8 new_path = push_str8f(scratch.arena, "%S/%S/", existing_path, files[0].filename);
df_view_equip_spec(ws, view, view->spec, new_path, &md_nil_node);
df_view_equip_query(view, new_path);
}
else
{
@@ -4056,7 +4039,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
String8 new_path = str8_chop_last_slash(str8_chop_last_slash(path_query.path));
new_path = path_normalized_from_string(scratch.arena, new_path);
String8 new_cmd = push_str8f(scratch.arena, "%S%s", new_path, new_path.size != 0 ? "/" : "");
df_view_equip_spec(ws, view, view->spec, new_cmd, &md_nil_node);
df_view_equip_query(view, new_cmd);
}
}
@@ -4138,7 +4121,7 @@ DF_VIEW_UI_FUNCTION_DEF(FileSystem)
if(file->props.flags & FilePropertyFlag_IsFolder)
{
String8 new_cmd = push_str8f(scratch.arena, "%S%s", new_path, new_path.size != 0 ? "/" : "");
df_view_equip_spec(ws, view, view->spec, new_cmd, &md_nil_node);
df_view_equip_query(view, new_cmd);
}
else
{
@@ -8396,7 +8379,7 @@ DF_VIEW_UI_FUNCTION_DEF(Bitmap)
}
////////////////////////////////
//~ rjf: Color @view_hook_impl
//~ rjf: ColorRGBA @view_hook_impl
DF_VIEW_SETUP_FUNCTION_DEF(ColorRGBA) {}
DF_VIEW_CMD_FUNCTION_DEF(ColorRGBA) {}
@@ -8445,6 +8428,158 @@ DF_VIEW_UI_FUNCTION_DEF(ColorRGBA)
scratch_end(scratch);
}
////////////////////////////////
//~ rjf: Geometry3D @view_hook_impl
internal UI_BOX_CUSTOM_DRAW(df_geometry3d_box_draw)
{
DF_Geometry3DBoxDrawData *draw_data = (DF_Geometry3DBoxDrawData *)user_data;
// rjf: get clip
Rng2F32 clip = box->rect;
for(UI_Box *b = box->parent; !ui_box_is_nil(b); b = b->parent)
{
if(b->flags & UI_BoxFlag_Clip)
{
clip = intersect_2f32(b->rect, clip);
}
}
// rjf: calculate eye/target
Vec3F32 target = {0};
Vec3F32 eye = v3f32(draw_data->zoom*cos_f32(draw_data->yaw)*sin_f32(draw_data->pitch),
draw_data->zoom*sin_f32(draw_data->yaw)*sin_f32(draw_data->pitch),
draw_data->zoom*cos_f32(draw_data->pitch));
// rjf: mesh
Vec2F32 box_dim = dim_2f32(box->rect);
R_PassParams_Geo3D *pass = d_geo3d_begin(box->rect,
make_look_at_4x4f32(eye, target, v3f32(0, 0, 1)),
make_perspective_4x4f32(0.25f, box_dim.x/box_dim.y, 0.1f, 500.f));
pass->clip = clip;
d_mesh(draw_data->vertex_buffer, draw_data->index_buffer, R_GeoTopologyKind_Triangles, R_GeoVertexFlag_TexCoord|R_GeoVertexFlag_Normals|R_GeoVertexFlag_RGB, r_handle_zero(), mat_4x4f32(1.f));
}
DF_VIEW_SETUP_FUNCTION_DEF(Geometry3D)
{
df_view_equip_loading_info(view, 1, 0, 0);
view->loading_t = view->loading_t_target = 1.f;
}
DF_VIEW_CMD_FUNCTION_DEF(Geometry3D) {}
DF_VIEW_UI_FUNCTION_DEF(Geometry3D)
{
Temp scratch = scratch_begin(0, 0);
GEO_Scope *geo_scope = geo_scope_open();
DF_Geometry3DViewState *state = df_view_user_state(view, DF_Geometry3DViewState);
//////////////////////////////
//- rjf: unpack parameters
//
U64 count = df_value_from_params_key(params, str8_lit("count")).u64;
U64 vtx_base_off = df_value_from_params_key(params, str8_lit("vtx")).u64;
U64 vtx_size = df_value_from_params_key(params, str8_lit("vtx_size")).u64;
F32 yaw_target = df_value_from_params_key(params, str8_lit("yaw")).f32;
F32 pitch_target = df_value_from_params_key(params, str8_lit("pitch")).f32;
F32 zoom_target = df_value_from_params_key(params, str8_lit("zoom")).f32;
//////////////////////////////
//- rjf: evaluate & unpack expression
//
E_Eval eval = e_eval_from_string(scratch.arena, string);
U64 base_offset = df_base_offset_from_eval(eval);
Rng1U64 idxs_range = r1u64(base_offset, base_offset+count*sizeof(U32));
Rng1U64 vtxs_range = r1u64(vtx_base_off, vtx_base_off+vtx_size);
U128 idxs_key = df_key_from_eval_space_range(eval.space, idxs_range, 0);
U128 vtxs_key = df_key_from_eval_space_range(eval.space, vtxs_range, 0);
R_Handle idxs_buffer = geo_buffer_from_key(geo_scope, idxs_key);
R_Handle vtxs_buffer = geo_buffer_from_key(geo_scope, vtxs_key);
//////////////////////////////
//- rjf: equip loading info
//
if(eval.msgs.max_kind == E_MsgKind_Null &&
(r_handle_match(idxs_buffer, r_handle_zero()) ||
r_handle_match(vtxs_buffer, r_handle_zero())))
{
df_view_equip_loading_info(view, 1, 0, 0);
}
//////////////////////////////
//- rjf: do first-time camera initialization, if needed
//
if(zoom_target == 0)
{
yaw_target = -0.125f;
pitch_target = -0.125f;
zoom_target = 3.5f;
}
//////////////////////////////
//- rjf: animate camera
//
{
F32 fast_rate = 1 - pow_f32(2, (-60.f * df_dt()));
F32 slow_rate = 1 - pow_f32(2, (-30.f * df_dt()));
state->zoom += (zoom_target - state->zoom) * slow_rate;
state->yaw += (yaw_target - state->yaw) * fast_rate;
state->pitch += (pitch_target - state->pitch) * fast_rate;
if(abs_f32(state->zoom - zoom_target) > 0.001f ||
abs_f32(state->yaw - yaw_target) > 0.001f ||
abs_f32(state->pitch - pitch_target) > 0.001f)
{
df_gfx_request_frame();
}
}
//////////////////////////////
//- rjf: build
//
if(count != 0 && !r_handle_match(idxs_buffer, r_handle_zero()) && !r_handle_match(vtxs_buffer, r_handle_zero()))
{
Vec2F32 dim = dim_2f32(rect);
UI_Box *box = &ui_g_nil_box;
UI_FixedSize(dim)
{
box = ui_build_box_from_stringf(UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawBackground|UI_BoxFlag_Clickable|UI_BoxFlag_Scroll, "geo_box");
}
UI_Signal sig = ui_signal_from_box(box);
if(ui_dragging(sig))
{
if(ui_pressed(sig))
{
DF_CmdParams p = df_cmd_params_from_view(ws, panel, view);
df_push_cmd__root(&p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FocusPanel));
Vec2F32 data = v2f32(yaw_target, pitch_target);
ui_store_drag_struct(&data);
}
Vec2F32 drag_delta = ui_drag_delta();
Vec2F32 drag_start_data = *ui_get_drag_struct(Vec2F32);
yaw_target = drag_start_data.x + drag_delta.x/dim.x;
pitch_target = drag_start_data.y + drag_delta.y/dim.y;
}
zoom_target += sig.scroll.y;
zoom_target = Clamp(0.1f, zoom_target, 100.f);
pitch_target = Clamp(-0.49f, pitch_target, -0.01f);
DF_Geometry3DBoxDrawData *draw_data = push_array(ui_build_arena(), DF_Geometry3DBoxDrawData, 1);
draw_data->yaw = state->yaw;
draw_data->pitch = state->pitch;
draw_data->zoom = state->zoom;
draw_data->vertex_buffer = vtxs_buffer;
draw_data->index_buffer = idxs_buffer;
ui_box_equip_custom_draw(box, df_geometry3d_box_draw, draw_data);
}
//////////////////////////////
//- rjf: commit parameters
//
df_view_store_param_f32(view, str8_lit("yaw"), yaw_target);
df_view_store_param_f32(view, str8_lit("pitch"), pitch_target);
df_view_store_param_f32(view, str8_lit("zoom"), zoom_target);
geo_scope_close(geo_scope);
scratch_end(scratch);
}
////////////////////////////////
//~ rjf: ExceptionFilters @view_hook_impl
+21
View File
@@ -457,6 +457,27 @@ struct DF_BitmapCanvasBoxDrawData
F32 zoom;
};
////////////////////////////////
//~ rjf: Geometry3D @view_types
typedef struct DF_Geometry3DViewState DF_Geometry3DViewState;
struct DF_Geometry3DViewState
{
F32 yaw;
F32 pitch;
F32 zoom;
};
typedef struct DF_Geometry3DBoxDrawData DF_Geometry3DBoxDrawData;
struct DF_Geometry3DBoxDrawData
{
F32 yaw;
F32 pitch;
F32 zoom;
R_Handle vertex_buffer;
R_Handle index_buffer;
};
////////////////////////////////
//~ rjf: Settings @view_types
+3 -2
View File
@@ -140,7 +140,7 @@ str8_lit_comp("add_address_breakpoint"),
str8_lit_comp("add_function_breakpoint"),
};
DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[33] =
DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[34] =
{
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_ProjectSpecific|0*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanFilter|0*DF_ViewSpecFlag_FilterIsCode|0*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("null"), str8_lit_comp(""), DF_IconKind_Null, DF_VIEW_SETUP_FUNCTION_NAME(Null), DF_VIEW_CMD_FUNCTION_NAME(Null), DF_VIEW_UI_FUNCTION_NAME(Null)},
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_ProjectSpecific|0*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanFilter|0*DF_ViewSpecFlag_FilterIsCode|0*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("empty"), str8_lit_comp(""), DF_IconKind_Null, DF_VIEW_SETUP_FUNCTION_NAME(Empty), DF_VIEW_CMD_FUNCTION_NAME(Empty), DF_VIEW_UI_FUNCTION_NAME(Empty)},
@@ -173,6 +173,7 @@ DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[33] =
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_ProjectSpecific|1*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanFilter|1*DF_ViewSpecFlag_FilterIsCode|0*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("memory"), str8_lit_comp("Memory"), DF_IconKind_Grid, DF_VIEW_SETUP_FUNCTION_NAME(Memory), DF_VIEW_CMD_FUNCTION_NAME(Memory), DF_VIEW_UI_FUNCTION_NAME(Memory)},
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_ProjectSpecific|1*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanFilter|1*DF_ViewSpecFlag_FilterIsCode|0*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("bitmap"), str8_lit_comp("Bitmap"), DF_IconKind_Binoculars, DF_VIEW_SETUP_FUNCTION_NAME(Bitmap), DF_VIEW_CMD_FUNCTION_NAME(Bitmap), DF_VIEW_UI_FUNCTION_NAME(Bitmap)},
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_ProjectSpecific|1*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanFilter|1*DF_ViewSpecFlag_FilterIsCode|0*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("color_rgba"), str8_lit_comp("Color (RGBA)"), DF_IconKind_Palette, DF_VIEW_SETUP_FUNCTION_NAME(ColorRGBA), DF_VIEW_CMD_FUNCTION_NAME(ColorRGBA), DF_VIEW_UI_FUNCTION_NAME(ColorRGBA)},
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_ProjectSpecific|1*DF_ViewSpecFlag_CanSerialize|0*DF_ViewSpecFlag_CanFilter|1*DF_ViewSpecFlag_FilterIsCode|0*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("geometry_3d"), str8_lit_comp("Geometry (3D)"), DF_IconKind_Binoculars, DF_VIEW_SETUP_FUNCTION_NAME(Geometry3D), DF_VIEW_CMD_FUNCTION_NAME(Geometry3D), DF_VIEW_UI_FUNCTION_NAME(Geometry3D)},
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_ProjectSpecific|1*DF_ViewSpecFlag_CanSerialize|1*DF_ViewSpecFlag_CanFilter|0*DF_ViewSpecFlag_FilterIsCode|1*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("exception_filters"), str8_lit_comp("Exception Filters"), DF_IconKind_Gear, DF_VIEW_SETUP_FUNCTION_NAME(ExceptionFilters), DF_VIEW_CMD_FUNCTION_NAME(ExceptionFilters), DF_VIEW_UI_FUNCTION_NAME(ExceptionFilters)},
{(0|0*DF_ViewSpecFlag_ParameterizedByEntity|0*DF_ViewSpecFlag_ProjectSpecific|1*DF_ViewSpecFlag_CanSerialize|1*DF_ViewSpecFlag_CanFilter|0*DF_ViewSpecFlag_FilterIsCode|1*DF_ViewSpecFlag_TypingAutomaticallyFilters), str8_lit_comp("settings"), str8_lit_comp("Settings"), DF_IconKind_Gear, DF_VIEW_SETUP_FUNCTION_NAME(Settings), DF_VIEW_CMD_FUNCTION_NAME(Settings), DF_VIEW_UI_FUNCTION_NAME(Settings)},
};
@@ -227,7 +228,7 @@ DF_GfxViewRuleSpecInfo df_g_gfx_view_rule_spec_info_table[16] =
{ str8_lit_comp("disasm"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*0)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0, str8_lit_comp("disassembly") },
{ str8_lit_comp("memory"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*0)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0, str8_lit_comp("memory") },
{ str8_lit_comp("bitmap"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*0)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0, str8_lit_comp("bitmap") },
{ str8_lit_comp("geo"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*1)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(geo) , str8_lit_comp("geometry") },
{ str8_lit_comp("geo3d"), (DF_GfxViewRuleSpecInfoFlag_VizRowProd*0)|(DF_GfxViewRuleSpecInfoFlag_LineStringize*0)|(DF_GfxViewRuleSpecInfoFlag_RowUI*0)|(DF_GfxViewRuleSpecInfoFlag_ViewUI*1), 0, 0, 0, str8_lit_comp("geometry_3d") },
};
String8 df_g_theme_preset_display_string_table[9] =
+5 -2
View File
@@ -39,6 +39,7 @@ DF_GfxViewKind_Output,
DF_GfxViewKind_Memory,
DF_GfxViewKind_Bitmap,
DF_GfxViewKind_ColorRGBA,
DF_GfxViewKind_Geometry3D,
DF_GfxViewKind_ExceptionFilters,
DF_GfxViewKind_Settings,
DF_GfxViewKind_COUNT,
@@ -193,6 +194,7 @@ DF_VIEW_SETUP_FUNCTION_DEF(Output);
DF_VIEW_SETUP_FUNCTION_DEF(Memory);
DF_VIEW_SETUP_FUNCTION_DEF(Bitmap);
DF_VIEW_SETUP_FUNCTION_DEF(ColorRGBA);
DF_VIEW_SETUP_FUNCTION_DEF(Geometry3D);
DF_VIEW_SETUP_FUNCTION_DEF(ExceptionFilters);
DF_VIEW_SETUP_FUNCTION_DEF(Settings);
DF_VIEW_CMD_FUNCTION_DEF(Null);
@@ -226,6 +228,7 @@ DF_VIEW_CMD_FUNCTION_DEF(Output);
DF_VIEW_CMD_FUNCTION_DEF(Memory);
DF_VIEW_CMD_FUNCTION_DEF(Bitmap);
DF_VIEW_CMD_FUNCTION_DEF(ColorRGBA);
DF_VIEW_CMD_FUNCTION_DEF(Geometry3D);
DF_VIEW_CMD_FUNCTION_DEF(ExceptionFilters);
DF_VIEW_CMD_FUNCTION_DEF(Settings);
DF_VIEW_UI_FUNCTION_DEF(Null);
@@ -259,6 +262,7 @@ DF_VIEW_UI_FUNCTION_DEF(Output);
DF_VIEW_UI_FUNCTION_DEF(Memory);
DF_VIEW_UI_FUNCTION_DEF(Bitmap);
DF_VIEW_UI_FUNCTION_DEF(ColorRGBA);
DF_VIEW_UI_FUNCTION_DEF(Geometry3D);
DF_VIEW_UI_FUNCTION_DEF(ExceptionFilters);
DF_VIEW_UI_FUNCTION_DEF(Settings);
@@ -274,12 +278,11 @@ DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(omit);
DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(no_addr);
DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(checkbox);
DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(rgba);
DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(geo);
C_LINKAGE_BEGIN
extern DF_StringBindingPair df_g_default_binding_table[110];
extern String8 df_g_binding_version_remap_old_name_table[7];
extern String8 df_g_binding_version_remap_new_name_table[7];
extern DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[33];
extern DF_ViewSpecInfo df_g_gfx_view_kind_spec_info_table[34];
extern DF_CmdParamSlot df_g_cmd_param_slot_2_view_spec_src_map[7];
extern String8 df_g_cmd_param_slot_2_view_spec_dst_map[7];
extern String8 df_g_cmd_param_slot_2_view_spec_cmd_map[7];
+7 -3
View File
@@ -361,6 +361,10 @@ md_string_from_children(Arena *arena, MD_Node *root)
String8List strs = {0};
for(MD_EachNode(child, root->first))
{
if(child->flags == child->prev->flags)
{
str8_list_push(scratch.arena, &strs, str8_lit(" "));
}
str8_list_push(scratch.arena, &strs, child->string);
}
String8 result = str8_list_join(arena, &strs, 0);
@@ -393,7 +397,7 @@ md_node_match(MD_Node *a, MD_Node *b, StringMatchFlags flags)
!md_node_is_nil(a_tag_arg) || !md_node_is_nil(b_tag_arg);
a_tag_arg = a_tag_arg->next, b_tag_arg = b_tag_arg->next)
{
if(!md_node_deep_match(a_tag_arg, b_tag_arg, flags))
if(!md_tree_match(a_tag_arg, b_tag_arg, flags))
{
result = 0;
goto end;
@@ -413,7 +417,7 @@ md_node_match(MD_Node *a, MD_Node *b, StringMatchFlags flags)
}
internal B32
md_node_deep_match(MD_Node *a, MD_Node *b, StringMatchFlags flags)
md_tree_match(MD_Node *a, MD_Node *b, StringMatchFlags flags)
{
B32 result = md_node_match(a, b, flags);
if(result)
@@ -422,7 +426,7 @@ md_node_deep_match(MD_Node *a, MD_Node *b, StringMatchFlags flags)
!md_node_is_nil(a_child) || !md_node_is_nil(b_child);
a_child = a_child->next, b_child = b_child->next)
{
if(!md_node_deep_match(a_child, b_child, flags))
if(!md_tree_match(a_child, b_child, flags))
{
result = 0;
goto end;
+1 -1
View File
@@ -282,7 +282,7 @@ internal U64 md_tag_count_from_node(MD_Node *node);
internal String8 md_string_from_children(Arena *arena, MD_Node *root);
//- rjf: tree comparison
internal B32 md_node_deep_match(MD_Node *a, MD_Node *b, StringMatchFlags flags);
internal B32 md_tree_match(MD_Node *a, MD_Node *b, StringMatchFlags flags);
internal B32 md_node_match(MD_Node *a, MD_Node *b, StringMatchFlags flags);
//- rjf: tree duplication
+1 -1
View File
@@ -1857,7 +1857,7 @@ fancy_viz_eval_tests(void)
136, 137, 138, 138, 139, 136, 140, 141, 142, 142, 143, 140, 144, 145, 146, 146, 147, 144, 148, 149, 150, 150, 151, 148,
152, 153, 154, 154, 155, 152, 156, 157, 158, 158, 159, 156, 160, 161, 162, 162, 163, 160, 164, 165, 166, 166, 167, 164,
};
raddbg_pin(index_data, "geo: { count:(sizeof index_data / 4), vertices_base:(vertex_data), vertices_size:(sizeof vertex_data) }");
raddbg_pin(index_data, "geo3d: { count:(sizeof index_data/4), vtx:(vertex_data), vtx_size:(sizeof vertex_data) }");
int x3 = 0;
}
+2
View File
@@ -1047,6 +1047,8 @@ internal void ui_pop_corner_radius(void);
#define UI_TextAlignment(v) DeferLoop(ui_push_text_alignment(v), ui_pop_text_alignment())
//- rjf: stacks (compositions)
#define UI_FixedPos(v) DeferLoop((ui_push_fixed_x((v).x), ui_push_fixed_y((v).y)), (ui_pop_fixed_x(), ui_pop_fixed_y()))
#define UI_FixedSize(v) DeferLoop((ui_push_fixed_width((v).x), ui_push_fixed_height((v).y)), (ui_pop_fixed_width(), ui_pop_fixed_height()))
#define UI_WidthFill UI_PrefWidth(ui_pct(1.f, 0.f))
#define UI_HeightFill UI_PrefHeight(ui_pct(1.f, 0.f))
#define UI_Rect(r) DeferLoop(ui_push_rect(r), ui_pop_rect())