diff --git a/code/font/VEFontCache/LRU.odin b/code/font/VEFontCache/LRU.odin index 0ad43cc..db5d440 100644 --- a/code/font/VEFontCache/LRU.odin +++ b/code/font/VEFontCache/LRU.odin @@ -152,7 +152,7 @@ LRU_Cache :: struct { LRU_init :: proc( cache : ^LRU_Cache, capacity : u32, dbg_name : string = "" ) { error : AllocatorError cache.capacity = capacity - cache.table, error = make( map[u64]LRU_Link, hmap_closest_prime( uint(capacity)) ) + cache.table, error = make( map[u64]LRU_Link, uint(capacity) ) assert( error == .None, "VEFontCache.LRU_init : Failed to allocate cache's table") pool_list_init( & cache.key_queue, capacity, dbg_name = dbg_name ) diff --git a/code/font/VEFontCache/VEFontCache.odin b/code/font/VEFontCache/VEFontCache.odin index e5682c0..4e2d80c 100644 --- a/code/font/VEFontCache/VEFontCache.odin +++ b/code/font/VEFontCache/VEFontCache.odin @@ -177,7 +177,7 @@ startup :: proc( ctx : ^Context, parser_kind : ParserKind, temp_path, error = make( [dynamic]Vec2, temp_path_reserve ) assert(error == .None, "VEFontCache.init : Failed to allocate temp_path") - temp_codepoint_seen, error = make( map[u64]bool, hmap_closest_prime( uint(temp_codepoint_seen_reserve)) ) + temp_codepoint_seen, error = make( map[u64]bool, uint(temp_codepoint_seen_reserve) ) assert(error == .None, "VEFontCache.init : Failed to allocate temp_path") draw_list.vertices, error = make( [dynamic]Vertex, 4 * Kilobyte ) diff --git a/code/font/VEFontCache/mappings.odin b/code/font/VEFontCache/mappings.odin index d81a706..2ba2b78 100644 --- a/code/font/VEFontCache/mappings.odin +++ b/code/font/VEFontCache/mappings.odin @@ -12,7 +12,6 @@ import "core:math" ceil_f64 :: math.ceil_f64 ceil_f64le :: math.ceil_f64le ceil_f64be :: math.ceil_f64be - import "core:math/linalg" import "core:mem" Kilobyte :: mem.Kilobyte @@ -25,12 +24,9 @@ import "core:mem" arena_allocator :: mem.arena_allocator arena_init :: mem.arena_init import "codebase:grime" - hmap_closest_prime :: grime.hmap_closest_prime log :: grime.log logf :: grime.logf profile :: grime.profile - reload_array :: grime.reload_array - reload_map :: grime.reload_map //#region("Proc overload mappings") diff --git a/code/font/VEFontCache/misc.odin b/code/font/VEFontCache/misc.odin index 5b4f409..17a91b8 100644 --- a/code/font/VEFontCache/misc.odin +++ b/code/font/VEFontCache/misc.odin @@ -1,5 +1,17 @@ package VEFontCache +import "base:runtime" + +reload_array :: proc( self : ^[dynamic]$Type, allocator : Allocator ) { + raw := transmute( ^runtime.Raw_Dynamic_Array) self + raw.allocator = allocator +} + +reload_map :: proc( self : ^map [$KeyType] $EntryType, allocator : Allocator ) { + raw := transmute( ^runtime.Raw_Map) self + raw.allocator = allocator +} + font_glyph_lru_code :: #force_inline proc "contextless" ( font : FontID, glyph_index : Glyph ) -> (lru_code : u64) { lru_code = u64(glyph_index) + ( ( 0x100000000 * u64(font) ) & 0xFFFFFFFF00000000 ) return