Not using dynamic map temporarily for font caching

There is an issue with hot-reloading dynamic maps. So I'll be using my own dynamic array and hashtable instead to debug the reason.
This commit is contained in:
2024-02-14 02:29:08 -05:00
parent 8d4b59353f
commit 2da0554c78
4 changed files with 23 additions and 17 deletions

View File

@ -19,7 +19,7 @@ ModuleAPI :: struct {
lib_version : i32,
startup : type_of( startup ),
shutdown : type_of( sectr_shutdown),
shutdown : type_of( sectr_shutdown ),
reload : type_of( reload ),
tick : type_of( tick ),
clean_temp : type_of( clean_temp ),
@ -141,12 +141,10 @@ startup :: proc( live_mem : virtual.Arena, snapshot_mem : []u8, host_logger : ^
// }
frame_1.color = Color_BG_TextBox
// Frame is getting interpreted as points (It doesn't have to be, I'm just doing it...)
box_set_size( & frame_1, { 100, 50 } * CM_Per_Point )
frame_2.color = Color_BG_TextBox_Green
box_set_size( & frame_2, { 60, 100 } * CM_Per_Point )
// frame_1.position = { 1000, 1000 }
}
}
}
@ -197,6 +195,11 @@ reload :: proc( live_mem : virtual.Arena, snapshot_mem : []u8, host_logger : ^ L
context.allocator = transient_allocator()
context.temp_allocator = temp_allocator()
// Procedure Addresses are not preserved on hot-reload. They must be restored for persistent data.
// The only way to alleviate this is to either do custom handles to allocators
// Or as done below, correct containers using allocators on reload.
// Thankfully persistent dynamic allocations are rare, and thus we know exactly which ones they are.
// font_provider_data := & get_state().font_provider_data
// font_provider_data.font_cache.allocator = arena_allocator( & font_provider_data.font_arena )