LRU cache now as templated key type

Was testing to see if 16-bit cach emade a diff for the glyphs (it did not)
This commit is contained in:
2025-01-06 21:18:39 -05:00
parent bf38087d8e
commit a9080fe1f3
12 changed files with 185 additions and 120 deletions

View File

@ -354,8 +354,8 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem
// debug.path_lorem = str_fmt("C:/projects/SectrPrototype/examples/Lorem Ipsum (197).txt", allocator = persistent_slab_allocator())
// debug.path_lorem = str_fmt("C:/projects/SectrPrototype/examples/Lorem Ipsum (1022).txt", allocator = persistent_slab_allocator())
// debug.path_lorem = str_fmt("C:/projects/SectrPrototype/examples/sokol_gp.h", allocator = persistent_slab_allocator())
debug.path_lorem = str_fmt("C:/projects/SectrPrototype/examples/ve_fontcache.h", allocator = persistent_slab_allocator())
debug.path_lorem = str_fmt("C:/projects/SectrPrototype/examples/sokol_gp.h", allocator = persistent_slab_allocator())
// debug.path_lorem = str_fmt("C:/projects/SectrPrototype/examples/ve_fontcache.h", allocator = persistent_slab_allocator())
alloc_error : AllocatorError; success : bool
debug.lorem_content, success = os.read_entire_file( debug.path_lorem, persistent_slab_allocator() )
@ -528,8 +528,8 @@ tick_work_frame :: #force_inline proc( host_delta_time_ms : f64 ) -> b32
debug.draw_ui_padding_bounds = false
debug.draw_ui_content_bounds = false
font_provider_set_alpha_sharpen(0.15)
font_provider_set_snap_glyph_pos(false)
font_provider_set_alpha_sharpen(0.25)
font_provider_set_snap_glyph_pos(true)
// config.engine_refresh_hz = 165

View File

@ -57,6 +57,7 @@ render_mode_2d_workspace :: proc( screen_extent : Vec2, cam : Camera, input : In
screen_size := screen_extent * 2
// TODO(Ed): Eventually will be the viewport extents
ve.set_px_scalar( ve_ctx, app_config().font_size_canvas_scalar )
ve.configure_snap( ve_ctx, u32(screen_size.x), u32(screen_size.y) )
// ve.configure_snap( ve_ctx, 0, 0 )
@ -122,6 +123,7 @@ render_mode_screenspace :: proc( screen_extent : Extents2, screen_ui : ^UI_State
screen_size := screen_extent * 2
screen_ratio := screen_size.x * ( 1.0 / screen_size.y )
ve.set_px_scalar( ve_ctx, app_config().font_size_screen_scalar )
ve.configure_snap( ve_ctx, u32(screen_size.x), u32(screen_size.y) )
render_screen_ui( screen_extent, screen_ui, ve_ctx, ve_render )
@ -917,12 +919,18 @@ draw_text_string_pos_norm :: #force_inline proc( text : string, id : FontID, fon
width := app_window.extent.x * 2
height := app_window.extent.y * 2
ve_id, resolved_size := font_provider_resolve_draw_id( id, font_size )
// over_sample : f32 = f32(config.font_size_screen_scalar)
target_size := font_size
// target_size *= over_sample
ve_id, resolved_size := font_provider_resolve_draw_id( id, target_size )
color_norm := normalize_rgba8(color)
screen_size_norm := 1 / Vec2 { width, height }
draw_scale := screen_size_norm * scale
// draw_scale /= over_sample
// ve.set_px_scalar( & font_provider_ctx.ve_ctx, config.font_size_screen_scalar )
ve.set_colour( & font_provider_ctx.ve_ctx, color_norm )
@ -938,6 +946,7 @@ draw_text_string_pos_extent :: #force_inline proc( text : string, id : FontID, f
screen_size := app_window.extent * 2
render_pos := screen_to_render_pos(pos)
normalized_pos := render_pos * (1.0 / screen_size)
draw_text_string_pos_norm( text, id, font_size, normalized_pos, color )
}