From 894c3fee97f35c45caa9ef4fe1dc3236cd1335a3 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 24 Jun 2024 23:38:53 -0400 Subject: [PATCH] Fix hot-reload --- code/font/VEFontCache/VEFontCache.odin | 8 +++++++- code/grime/hashmap_chained.odin | 2 +- code/sectr/engine/client_api.odin | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/code/font/VEFontCache/VEFontCache.odin b/code/font/VEFontCache/VEFontCache.odin index 6f3200a..cbf8795 100644 --- a/code/font/VEFontCache/VEFontCache.odin +++ b/code/font/VEFontCache/VEFontCache.odin @@ -374,7 +374,8 @@ hot_reload :: proc( ctx : ^Context, allocator : Allocator ) entries.backing = allocator temp_path.backing = allocator - hmap_zpl_reload( & temp_codepoint_seen, allocator ) + hmap_zpl_reload( & ctx.temp_codepoint_seen, allocator ) + draw_list.vertices.backing = allocator draw_list.indices.backing = allocator draw_list.calls.backing = allocator @@ -400,6 +401,9 @@ hot_reload :: proc( ctx : ^Context, allocator : Allocator ) atlas.clear_draw_list.calls.backing = allocator atlas.clear_draw_list.indices.backing = allocator atlas.clear_draw_list.vertices.backing = allocator + + shape_cache.storage.backing = allocator + LRU_reload( & shape_cache.state, allocator ) } // ve_foncache_shutdown @@ -736,6 +740,8 @@ measure_text_size :: proc( ctx : ^Context, font : FontID, text_utf8 : string ) - assert( ctx != nil ) assert( font >= 0 && font < FontID(ctx.entries.num) ) + context.allocator = ctx.backing + atlas := ctx.atlas shaped := shape_text_cached( ctx, font, text_utf8 ) diff --git a/code/grime/hashmap_chained.odin b/code/grime/hashmap_chained.odin index 62bb1dc..cecdbc4 100644 --- a/code/grime/hashmap_chained.odin +++ b/code/grime/hashmap_chained.odin @@ -152,7 +152,7 @@ hmap_chained_get :: proc( using self : HMapChained($Type), key : u64) -> ^Type hmap_chained_reload :: proc( self : HMapChained($Type), allocator : Allocator ) { - // pool_reload(self.pool, allocator) + pool_reload(self.pool, allocator) } // Returns true if an slot was actually found and marked as vacant diff --git a/code/sectr/engine/client_api.odin b/code/sectr/engine/client_api.odin index 63b889f..3ab9e61 100644 --- a/code/sectr/engine/client_api.odin +++ b/code/sectr/engine/client_api.odin @@ -262,7 +262,7 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem font_rec_mono_semicasual_reg = font_load( path_rec_mono_semicasual_reg, 16.0, "RecMonoSemiCasual_Regular" ) path_squidgy_slimes := strings.concatenate( { Path_Assets, "Squidgy Slimes.ttf" } ) - font_squidgy_slimes = font_load( path_squidgy_slimes, 16.0, "Squidgy_Slime" ) + font_squidgy_slimes = font_load( path_squidgy_slimes, 32.0, "Squidgy_Slime" ) path_firacode := strings.concatenate( { Path_Assets, "FiraCode-Regular.ttf" } ) font_firacode = font_load( path_firacode, 16.0, "FiraCode" )