eliminate fallback key/hash pair cache in texture cache layer; we can rely on rewinding purely via the hash store layer

This commit is contained in:
Ryan Fleury
2024-03-26 11:50:44 -07:00
parent 4027338a2f
commit 7cf8da0b43
4 changed files with 46 additions and 115 deletions
+13 -3
View File
@@ -877,6 +877,17 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(bitmap)
U64 expected_size = topology_info.width*topology_info.height*r_tex2d_format_bytes_per_pixel_table[topology_info.fmt];
Rng1U64 vaddr_range = r1u64(base_vaddr, base_vaddr+expected_size);
//- rjf: obtain key for this data range
U128 texture_key = ctrl_hash_store_key_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, vaddr_range, 0);
// HACK(rjf): we should not need to explicitly inform the process memory cache layer here -
// want a joined "get me the key & load it" operation here
ctrl_stored_hash_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, vaddr_range, 0, 0, 0);
//- rjf: hash & topology -> texture
TEX_Topology topology = tex_topology_make(v2s32((S32)topology_info.width, (S32)topology_info.height), topology_info.fmt);
R_Handle texture = tex_texture_from_key_topology(tex_scope, texture_key, topology);
#if 0
//- rjf: unique identifying info about this address -> unique key
U128 texture_key = {0};
{
@@ -892,10 +903,8 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(bitmap)
//- rjf: address range -> hash
U128 hash = ctrl_stored_hash_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, vaddr_range, 0, 0, 0);
//- rjf: hash & topology -> texture
TEX_Topology topology = tex_topology_make(v2s32((S32)topology_info.width, (S32)topology_info.height), topology_info.fmt);
R_Handle texture = tex_texture_from_key_hash_topology(tex_scope, texture_key, hash, topology);
#endif
//- rjf: build preview
F32 rate = 1 - pow_f32(2, (-15.f * df_dt()));
@@ -941,6 +950,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(bitmap)
{
if(dim.y > (F32)topology_info.height)
{
U128 hash = hs_hash_from_key(texture_key, 0);
String8 data = hs_data_from_hash(hs_scope, hash);
U64 bytes_per_pixel = r_tex2d_format_bytes_per_pixel_table[topology.fmt];
U64 mouse_pixel_off = mouse_bitmap_px_off.y*topology_info.width + mouse_bitmap_px_off.x;
+8 -6
View File
@@ -5024,7 +5024,8 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
{
ProfBeginFunction();
Temp scratch = scratch_begin(0, 0);
DBGI_Scope *scope = dbgi_scope_open();
DBGI_Scope *dbgi_scope = dbgi_scope_open();
TXT_Scope *txt_scope = txt_scope_open();
DF_CodeViewState *tv = df_view_user_state(view, DF_CodeViewState);
//////////////////////////////
@@ -5050,10 +5051,10 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
U64 unwind_count = ctrl_ctx.unwind_count;
U64 rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, unwind_count);
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(scope, process, rip_vaddr);
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(dbgi_scope, process, rip_vaddr);
//////////////////////////////
//- rjf: unpack entity info
//- rjf: unpack file/text entity info
//
B32 entity_is_missing = !!(entity->flags & DF_EntityFlag_IsMissing && !(entity->flags & DF_EntityFlag_Output));
TXTI_Handle txti_handle = df_txti_handle_from_entity(entity);
@@ -5467,7 +5468,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
String8 expr = txti_string_from_handle_txt_rng(scratch.arena, txti_handle, expr_rng);
if(expr.size != 0)
{
DF_Eval eval = df_eval_from_string(scratch.arena, scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
DF_Eval eval = df_eval_from_string(scratch.arena, dbgi_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
if(eval.mode != EVAL_EvalMode_NULL)
{
df_set_hover_eval(ws, sig.mouse_expr_baseline_pos, ctrl_ctx, entity, sig.mouse_pt, 0, expr);
@@ -5788,7 +5789,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
String8 full_path = df_full_path_from_entity(scratch.arena, entity);
TXTI_Handle handle = txti_handle_from_path(full_path);
TXTI_BufferInfo info = txti_buffer_info_from_handle(scratch.arena, handle);
DBGI_Parse *parse = df_dbgi_parse_from_binary_file(scope, binary);
DBGI_Parse *parse = df_dbgi_parse_from_binary_file(dbgi_scope, binary);
if(parse->exe_props.modified < info.timestamp)
{
file_is_out_of_date = 1;
@@ -5851,7 +5852,8 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
}
}
dbgi_scope_close(scope);
txt_scope_close(txt_scope);
dbgi_scope_close(dbgi_scope);
scratch_end(scratch);
ProfEnd();
}