mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-20 19:04:58 -07:00
first pass at view rule lookup cache... this might not be the right thing here
This commit is contained in:
@@ -8305,6 +8305,32 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
||||
{
|
||||
df_entity_mark_for_deletion(map);
|
||||
}
|
||||
{
|
||||
DF_AutoViewRuleMapCache *cache = &df_state->auto_view_rule_cache;
|
||||
if(cache->arena == 0)
|
||||
{
|
||||
cache->arena = arena_alloc();
|
||||
}
|
||||
arena_clear(cache->arena);
|
||||
cache->slots_count = 1024;
|
||||
cache->slots = push_array(cache->arena, DF_AutoViewRuleSlot, cache->slots_count);
|
||||
DF_EntityList maps = df_query_cached_entity_list_with_kind(DF_EntityKind_AutoViewRule);
|
||||
for(DF_EntityNode *n = maps.first; n != 0; n = n->next)
|
||||
{
|
||||
DF_Entity *map = n->entity;
|
||||
DF_Entity *src = df_entity_child_from_kind(map, DF_EntityKind_Source);
|
||||
DF_Entity *dst = df_entity_child_from_kind(map, DF_EntityKind_Dest);
|
||||
String8 type = src->name;
|
||||
String8 view_rule = dst->name;
|
||||
U64 hash = df_hash_from_string(type);
|
||||
U64 slot_idx = hash%cache->slots_count;
|
||||
DF_AutoViewRuleSlot *slot = &cache->slots[slot_idx];
|
||||
DF_AutoViewRuleNode *node = push_array(cache->arena, DF_AutoViewRuleNode, 1);
|
||||
node->type = push_str8_copy(cache->arena, type);
|
||||
node->view_rule = push_str8_copy(cache->arena, view_rule);
|
||||
SLLQueuePush(slot->first, slot->last, node);
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
||||
//- rjf: general entity operations
|
||||
|
||||
+26
-2
@@ -920,6 +920,31 @@ struct DF_EntityListCache
|
||||
DF_EntityList list;
|
||||
};
|
||||
|
||||
//- rjf: auto view rules hash table cache
|
||||
|
||||
typedef struct DF_AutoViewRuleNode DF_AutoViewRuleNode;
|
||||
struct DF_AutoViewRuleNode
|
||||
{
|
||||
DF_AutoViewRuleNode *next;
|
||||
String8 type;
|
||||
String8 view_rule;
|
||||
};
|
||||
|
||||
typedef struct DF_AutoViewRuleSlot DF_AutoViewRuleSlot;
|
||||
struct DF_AutoViewRuleSlot
|
||||
{
|
||||
DF_AutoViewRuleNode *first;
|
||||
DF_AutoViewRuleNode *last;
|
||||
};
|
||||
|
||||
typedef struct DF_AutoViewRuleMapCache DF_AutoViewRuleMapCache;
|
||||
struct DF_AutoViewRuleMapCache
|
||||
{
|
||||
Arena *arena;
|
||||
U64 slots_count;
|
||||
DF_AutoViewRuleSlot *slots;
|
||||
};
|
||||
|
||||
//- rjf: per-run unwind cache
|
||||
|
||||
typedef struct DF_RunUnwindCacheNode DF_RunUnwindCacheNode;
|
||||
@@ -1117,8 +1142,7 @@ struct DF_State
|
||||
// rjf: entity query caches
|
||||
U64 kind_alloc_gens[DF_EntityKind_COUNT];
|
||||
DF_EntityListCache kind_caches[DF_EntityKind_COUNT];
|
||||
DF_EntityListCache dbg_info_cache;
|
||||
DF_EntityListCache bin_file_cache;
|
||||
DF_AutoViewRuleMapCache auto_view_rule_cache;
|
||||
|
||||
// rjf: per-run caches
|
||||
U64 unwind_cache_reggen_idx;
|
||||
|
||||
@@ -3950,7 +3950,7 @@ DF_VIEW_UI_FUNCTION_DEF(AutoViewRules)
|
||||
{
|
||||
edit_end = 1;
|
||||
edit_commit = avrs->input_editing;
|
||||
next_cursor.x = 2;
|
||||
next_cursor.x = 1;
|
||||
next_cursor.y = map_idx+1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user