mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
default expansion in eval visualization; apply to scheduler tree
This commit is contained in:
@@ -705,6 +705,7 @@ ev_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 str
|
||||
U64 child_id;
|
||||
EV_ViewRuleList *view_rules;
|
||||
U64 split_relative_idx;
|
||||
B32 default_expanded;
|
||||
};
|
||||
Task start_task = {0, tree.root, tree.root->expr, 1, top_level_view_rules, 0};
|
||||
Task *first_task = &start_task;
|
||||
@@ -717,6 +718,10 @@ ev_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 str
|
||||
// rjf: obtain expansion node & expansion state
|
||||
EV_ExpandNode *expand_node = ev_expand_node_from_key(view, key);
|
||||
B32 is_expanded = (expand_node != 0 && expand_node->expanded);
|
||||
if(t->default_expanded)
|
||||
{
|
||||
is_expanded ^= 1;
|
||||
}
|
||||
|
||||
// rjf: skip if not expanded
|
||||
if(!is_expanded)
|
||||
@@ -757,21 +762,24 @@ ev_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 str
|
||||
expansion_block->expand_view_rule_info_user_data = expand_info.user_data;
|
||||
expansion_block->row_count = expand_info.row_count;
|
||||
expansion_block->single_item = expand_info.single_item;
|
||||
expansion_block->rows_default_expanded = expand_info.rows_default_expanded;
|
||||
tree.total_row_count += expand_info.row_count;
|
||||
tree.total_item_count += expand_info.single_item ? 1 : expand_info.row_count;
|
||||
}
|
||||
|
||||
// rjf: iterate children expansions, recurse
|
||||
if(expand_node != 0 && expand_info.row_count != 0 && expand_view_rule_info->expr_expand_range_info)
|
||||
// rjf: gather children expansions from expansion state
|
||||
U64 child_count = 0;
|
||||
EV_Key *child_keys = 0;
|
||||
U64 *child_nums = 0;
|
||||
if(!child_count && !expand_info.rows_default_expanded && expand_node != 0 && expand_info.row_count != 0 && expand_view_rule_info->expr_expand_range_info)
|
||||
{
|
||||
// rjf: count children
|
||||
U64 child_count = 0;
|
||||
for(EV_ExpandNode *child = expand_node->first; child != 0; child = child->next, child_count += 1){}
|
||||
|
||||
// rjf: gather children keys & numbers
|
||||
B32 needs_sort = 0;
|
||||
EV_Key *child_keys = push_array(scratch.arena, EV_Key, child_count);
|
||||
U64 *child_nums = push_array(scratch.arena, U64, child_count);
|
||||
child_keys = push_array(scratch.arena, EV_Key, child_count);
|
||||
child_nums = push_array(scratch.arena, U64, child_count);
|
||||
{
|
||||
U64 idx = 0;
|
||||
for(EV_ExpandNode *child = expand_node->first; child != 0; child = child->next, idx += 1)
|
||||
@@ -807,45 +815,60 @@ ev_block_tree_from_expr(Arena *arena, EV_View *view, String8 filter, String8 str
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: iterate children expansions & generate recursion tasks
|
||||
}
|
||||
|
||||
// rjf: gather children expansions from inverse of expansion state
|
||||
if(!child_count && (expand_info.rows_default_expanded || expand_node == 0 && !expand_info.rows_default_expanded))
|
||||
{
|
||||
child_count = expand_info.row_count;
|
||||
child_keys = push_array(scratch.arena, EV_Key, child_count);
|
||||
child_nums = push_array(scratch.arena, U64, child_count);
|
||||
for(U64 idx = 0; idx < child_count; idx += 1)
|
||||
{
|
||||
U64 split_num = child_nums[idx];
|
||||
U64 split_relative_idx = split_num - 1;
|
||||
if(split_relative_idx >= expand_info.row_count)
|
||||
U64 child_id = expand_view_rule_info->expr_expand_id_from_num(idx+1, expand_info.user_data);
|
||||
child_keys[idx] = ev_key_make(ev_hash_from_key(key), child_id);
|
||||
child_nums[idx] = idx+1;
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: iterate children expansions & generate recursion tasks
|
||||
for(U64 idx = 0; idx < child_count; idx += 1)
|
||||
{
|
||||
U64 split_num = child_nums[idx];
|
||||
U64 split_relative_idx = split_num - 1;
|
||||
if(split_relative_idx >= expand_info.row_count)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
EV_ExpandRangeInfo child_expand = expand_view_rule_info->expr_expand_range_info(arena, view, filter, t->expr, expand_params, r1u64(split_relative_idx, split_relative_idx+1), expand_info.user_data);
|
||||
if(child_expand.row_exprs_count > 0)
|
||||
{
|
||||
EV_Key child_key = child_keys[idx];
|
||||
E_Expr *child_expr = child_expand.row_exprs[0];
|
||||
EV_ViewRuleList *child_view_rules = ev_view_rule_list_from_inheritance(arena, t->view_rules);
|
||||
String8 child_view_rule_string = ev_view_rule_from_key(view, child_key);
|
||||
ev_view_rule_list_push_string(arena, child_view_rules, child_view_rule_string);
|
||||
if(child_expand.row_strings[0].size != 0)
|
||||
{
|
||||
continue;
|
||||
EV_ViewRuleList *fastpath_view_rules = ev_view_rule_list_from_expr_fastpaths(arena, child_expand.row_strings[0]);
|
||||
ev_view_rule_list_concat_in_place(child_view_rules, &fastpath_view_rules);
|
||||
}
|
||||
EV_ExpandRangeInfo child_expand = expand_view_rule_info->expr_expand_range_info(arena, view, filter, t->expr, expand_params, r1u64(split_relative_idx, split_relative_idx+1), expand_info.user_data);
|
||||
if(child_expand.row_exprs_count > 0)
|
||||
{
|
||||
EV_Key child_key = child_keys[idx];
|
||||
E_Expr *child_expr = child_expand.row_exprs[0];
|
||||
EV_ViewRuleList *child_view_rules = ev_view_rule_list_from_inheritance(arena, t->view_rules);
|
||||
String8 child_view_rule_string = ev_view_rule_from_key(view, child_key);
|
||||
ev_view_rule_list_push_string(arena, child_view_rules, child_view_rule_string);
|
||||
if(child_expand.row_strings[0].size != 0)
|
||||
{
|
||||
EV_ViewRuleList *fastpath_view_rules = ev_view_rule_list_from_expr_fastpaths(arena, child_expand.row_strings[0]);
|
||||
ev_view_rule_list_concat_in_place(child_view_rules, &fastpath_view_rules);
|
||||
}
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
E_IRTreeAndType child_irtree = e_irtree_and_type_from_expr(scratch.arena, child_expr);
|
||||
EV_ViewRuleList *child_auto_view_rules = ev_auto_view_rules_from_type_key(arena, child_irtree.type_key, 1, child_view_rule_string.size == 0);
|
||||
ev_view_rule_list_concat_in_place(child_view_rules, &child_auto_view_rules);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
E_Expr *child_expr__resolved = ev_resolved_from_expr(arena, child_expr, child_view_rules);
|
||||
Task *task = push_array(scratch.arena, Task, 1);
|
||||
SLLQueuePush(first_task, last_task, task);
|
||||
task->parent_block = expansion_block;
|
||||
task->expr = child_expr__resolved;
|
||||
task->child_id = child_key.child_id;
|
||||
task->view_rules = child_view_rules;
|
||||
task->split_relative_idx = split_relative_idx;
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
E_IRTreeAndType child_irtree = e_irtree_and_type_from_expr(scratch.arena, child_expr);
|
||||
EV_ViewRuleList *child_auto_view_rules = ev_auto_view_rules_from_type_key(arena, child_irtree.type_key, 1, child_view_rule_string.size == 0);
|
||||
ev_view_rule_list_concat_in_place(child_view_rules, &child_auto_view_rules);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
E_Expr *child_expr__resolved = ev_resolved_from_expr(arena, child_expr, child_view_rules);
|
||||
Task *task = push_array(scratch.arena, Task, 1);
|
||||
SLLQueuePush(first_task, last_task, task);
|
||||
task->parent_block = expansion_block;
|
||||
task->expr = child_expr__resolved;
|
||||
task->child_id = child_key.child_id;
|
||||
task->view_rules = child_view_rules;
|
||||
task->split_relative_idx = split_relative_idx;
|
||||
task->default_expanded = expand_info.rows_default_expanded;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ struct EV_ExpandInfo
|
||||
U64 row_count;
|
||||
B32 single_item; // all rows form a single "item" - a singular, but large, row
|
||||
B32 add_new_row; // also supports an 'add new row', as the final row, within `row_count`
|
||||
B32 rows_default_expanded;
|
||||
};
|
||||
|
||||
typedef struct EV_ExpandRangeInfo EV_ExpandRangeInfo;
|
||||
@@ -216,6 +217,7 @@ struct EV_Block
|
||||
// rjf: expansion info
|
||||
U64 row_count;
|
||||
B32 single_item;
|
||||
B32 rows_default_expanded;
|
||||
};
|
||||
|
||||
typedef struct EV_BlockTree EV_BlockTree;
|
||||
|
||||
@@ -6657,7 +6657,7 @@ rd_window_frame(RD_Window *ws)
|
||||
B32 row_is_expanded = ev_expansion_from_key(ev_view, row->key);
|
||||
if(row_is_expandable)
|
||||
UI_PrefWidth(ui_em(1.f, 1))
|
||||
if(ui_pressed(ui_expanderf(row_is_expanded, "###%I64x_%I64x_is_expanded", row->key.parent_hash, row->key.child_id)))
|
||||
if(ui_pressed(ui_expanderf(row->block->rows_default_expanded ? !row_is_expanded : row_is_expanded, "###%I64x_%I64x_is_expanded", row->key.parent_hash, row->key.child_id)))
|
||||
{
|
||||
ev_key_set_expansion(ev_view, row->block->key, row->key, !row_is_expanded);
|
||||
}
|
||||
@@ -8654,6 +8654,7 @@ EV_VIEW_RULE_EXPR_EXPAND_INFO_FUNCTION_DEF(scheduler_machine)
|
||||
*processes_array = ctrl_entity_array_from_list(arena, &processes);
|
||||
info.user_data = processes_array;
|
||||
info.row_count = processes.count;
|
||||
info.rows_default_expanded = 1;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return info;
|
||||
@@ -9071,6 +9072,11 @@ rd_ev_view_rule_expr_expand_info__meta_ctrl_entities(Arena *arena, EV_View *view
|
||||
}
|
||||
scratch_end(scratch);
|
||||
EV_ExpandInfo info = {accel, accel->entities.count};
|
||||
// TODO(rjf): hack
|
||||
if(kind == CTRL_EntityKind_Machine)
|
||||
{
|
||||
info.rows_default_expanded = 1;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
@@ -2652,7 +2652,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
case CTRL_EntityKind_Process:{slot = RD_RegSlot_Process; rd_regs()->process = ctrl_entity->handle;}break;
|
||||
case CTRL_EntityKind_Module: {slot = RD_RegSlot_Module; rd_regs()->module = ctrl_entity->handle;}break;
|
||||
}
|
||||
UI_PrefWidth(ui_em(2.f, 1.f)) if(ui_pressed(ui_expander(row_expanded, str8_lit("###expanded"))))
|
||||
UI_PrefWidth(ui_em(2.f, 1.f)) if(ui_pressed(ui_expander(row->block->rows_default_expanded ? !row_expanded : row_expanded, str8_lit("###expanded"))))
|
||||
{
|
||||
next_row_expanded = !row_expanded;
|
||||
}
|
||||
|
||||
@@ -44,10 +44,10 @@ struct RD_CodeViewBuildResult
|
||||
typedef U32 RD_WatchViewFlags;
|
||||
enum
|
||||
{
|
||||
RD_WatchViewFlag_NoHeader = (1<<0),
|
||||
RD_WatchViewFlag_PrettyNameMembers = (1<<1),
|
||||
RD_WatchViewFlag_PrettyEntityRows = (1<<2),
|
||||
RD_WatchViewFlag_DisableCacheLines = (1<<3),
|
||||
RD_WatchViewFlag_NoHeader = (1<<0),
|
||||
RD_WatchViewFlag_PrettyNameMembers = (1<<1),
|
||||
RD_WatchViewFlag_PrettyEntityRows = (1<<2),
|
||||
RD_WatchViewFlag_DisableCacheLines = (1<<3),
|
||||
};
|
||||
|
||||
typedef enum RD_WatchViewColumnKind
|
||||
|
||||
Reference in New Issue
Block a user