Another bugfix for hashmap_chained

This commit is contained in:
Edward R. Gonzalez 2024-12-31 11:26:21 -05:00
parent 9015f4ce3c
commit c7d465d06e
12 changed files with 31 additions and 25 deletions

Binary file not shown.

View File

@ -248,6 +248,7 @@ hmap_chained_set :: proc( self : HMapChained($Type), key : u64, value : Type ) -
block = slice_ptr(transmute([^]byte) raw_mem, slot_size)
// block, error = pool_grab(pool, false)
next := transmute( ^HMapChainedSlot(Type)) raw_data(block)
next^ = {}
slot.next = next
slot.next^ = {}
@ -257,7 +258,7 @@ hmap_chained_set :: proc( self : HMapChained($Type), key : u64, value : Type ) -
}
}
if ! slot.next.occupied || surface_slot.key == key
if ! slot.next.occupied || slot.next.key == key
{
slot.next.key = key
slot.next.value = value

View File

@ -50,7 +50,6 @@ logger_init :: proc( logger : ^ Logger, id : string, file_path : string, file :
LOGGER_VARENA_BASE_ADDRESS : uintptr = 2 * Terabyte
@static vmem_init_counter : uintptr = 0
when true {
alloc_error : AllocatorError
// logger.varena, alloc_error = varena_init(
// LOGGER_VARENA_BASE_ADDRESS + vmem_init_counter * 250 * Megabyte,
@ -64,9 +63,8 @@ logger_init :: proc( logger : ^ Logger, id : string, file_path : string, file :
vmem_init_counter += 1
// TODO(Ed): Figure out another solution here...
// logger.entries, alloc_error = array_init(Array(LoggerEntry), 8192, runtime.heap_allocator())
// verify( alloc_error == .None, "Failed to allocate logger's entries array")
}
logger.entries, alloc_error = array_init(Array(LoggerEntry), 8192, runtime.heap_allocator())
verify( alloc_error == .None, "Failed to allocate logger's entries array")
context.logger = { logger_interface, logger, core_log.Level.Debug, core_log.Default_File_Logger_Opts }
log("Initialized Logger")

View File

@ -338,7 +338,7 @@ pool_validate :: proc( pool : Pool )
pool_validate_ownership :: proc( using self : Pool, block : [] byte ) -> b32
{
profile(#procedure)
// profile(#procedure)
within_bucket := b32(false)
// Compiler Bug : Same as pool_reset

View File

@ -247,6 +247,7 @@ State :: struct {
font_neodgm_code : FontID,
font_rec_mono_linear : FontID,
font_roboto_regular : FontID,
font_roboto_mono_regular : FontID,
font_squidgy_slimes : FontID,
font_rec_mono_semicasual_reg : FontID,
default_font : FontID,

View File

@ -283,8 +283,8 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem
// path_noto_sans := strings.concatenate( { Path_Assets, "NotoSans-Regular.ttf" } )
// font_noto_sans = font_load( path_noto_sans, 16.0, "NotoSans" )
path_neodgm_code := strings.concatenate( { Path_Assets, "neodgm_code.ttf"} )
font_neodgm_code = font_load( path_neodgm_code, 32.0, "NeoDunggeunmo Code" )
// path_neodgm_code := strings.concatenate( { Path_Assets, "neodgm_code.ttf"} )
// font_neodgm_code = font_load( path_neodgm_code, 32.0, "NeoDunggeunmo Code" )
// path_rec_mono_linear := strings.concatenate( { Path_Assets, "RecMonoLinear-Regular-1.084.ttf" })
// font_rec_mono_linear = font_load( path_rec_mono_linear, 16.0, "RecMonoLinear Regular" )
@ -292,13 +292,16 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem
// path_roboto_regular := strings.concatenate( { Path_Assets, "Roboto-Regular.ttf"} )
// font_roboto_regular = font_load( path_roboto_regular, 32.0, "Roboto Regular" )
path_roboto_mono_regular := strings.concatenate( { Path_Assets, "RobotoMono-Regular.ttf"} )
font_roboto_mono_regular = font_load( path_roboto_mono_regular, 32.0, "Roboto Mono Regular" )
// path_arial_unicode_ms := strings.concatenate( { Path_Assets, "Arial Unicode MS.ttf" } )
// font_arial_unicode_ms = font_load( path_arial_unicode_ms, 16.0, "Arial_Unicode_MS" )
// path_arial_unicode_ms := strings.concatenate( { Path_Assets, "Arial Unicode MS.ttf" } )
// font_arial_unicode_ms = font_load( path_arial_unicode_ms, 16.0, "Arial_Unicode_MS" )
default_font = font_neodgm_code
default_font = font_roboto_mono_regular
log( "Default font loaded" )
}

View File

@ -107,7 +107,7 @@ render_mode_2d_workspace :: proc( screen_extent : Vec2, cam : Camera, input : In
cam := cam
when UI_Render_Method == .Layers {
render_list := array_to_slice( ui.render_list )
render_ui_via_box_list( render_list, & cam )
render_ui_via_box_list( render_list, screen_extent, ve_ctx, ve_render, & cam )
}
when UI_Render_Method == .Depth_First
{
@ -282,7 +282,7 @@ render_screen_ui :: proc( screen_extent : Extents2, ui : ^UI_State, ve_ctx : ^ve
when UI_Render_Method == .Layers {
render_list := array_to_slice( ui.render_list )
render_ui_via_box_list( render_list )
render_ui_via_box_list( render_list, screen_extent, ve_ctx, ve_render )
}
when UI_Render_Method == .Depth_First
{
@ -489,14 +489,14 @@ render_ui_via_box_tree :: proc( ui : ^UI_State, screen_extent : Vec2, ve_ctx : ^
using computed
profile("enqueue box")
// profile("enqueue box")
GP_Render:
{
corner_radii_total : f32 = 0
for radius in style.corner_radii do corner_radii_total += radius
profile("draw_shapes")
// profile("draw_shapes")
if style.bg_color.a != 0
{
render_set_color( style.bg_color )
@ -824,7 +824,7 @@ draw_text_string_pos_extent :: proc( content : string, id : FontID, size : f32,
draw_text_string_pos_extent_zoomed :: proc( content : string, id : FontID, size : f32, pos : Vec2, cam : Camera, color := Color_White )
{
profile(#procedure)
// profile(#procedure)
state := get_state(); using state // TODO(Ed): Remove usage of direct access to entire mutable state.
cam_offset := Vec2 {

View File

@ -64,7 +64,7 @@ UI_Style_Stack_Size :: 512
UI_Parent_Stack_Size :: 512
// UI_Built_Boxes_Array_Size :: 8
UI_Built_Boxes_Array_Size :: 56 * Kilobyte
UI_BoxCache_TableSize :: 4 * Kilobyte
UI_BoxCache_TableSize :: 8 * Kilobyte
UI_RenderEntry :: struct {
info : UI_RenderBoxInfo,
@ -226,8 +226,9 @@ ui_graph_build_end :: proc( ui : ^UI_State )
}
// Auto-layout and initial render_queue generation
profile_begin("Auto-layout and render_queue generation")
render_queue := array_to_slice(ui.render_queue)
for current := root.first; current != nil; current = ui_box_tranverse_next_depth_first( current )
for current := root.first; current != nil; current = ui_box_traverse_next_breadth_first( current, bypass_intersection_test = true )
{
if ! current.computed.fresh {
ui_box_compute_layout( current )
@ -293,7 +294,9 @@ ui_graph_build_end :: proc( ui : ^UI_State )
}
}
}
profile_end()
profile("render_list generation")
when UI_Render_Method == .Layers
{
// render_queue overlap corrections & render_list generation
@ -455,7 +458,7 @@ ui_hash_part_from_key_string :: proc ( content : string ) -> string {
ui_key_from_string :: #force_inline proc "contextless" ( value : string ) -> UI_Key
{
// profile(#procedure)
USE_RAD_DEBUGGERS_METHOD :: false
USE_RAD_DEBUGGERS_METHOD :: true
key : UI_Key

View File

@ -235,8 +235,8 @@ ui_compute_children_overall_bounds :: proc ( box : ^UI_Box ) -> ( children_bound
ui_box_compute_layout_children :: proc( box : ^UI_Box )
{
// for current := box.first; current != nil && current.prev != box; current = ui_box_traverse_next_breadth_first( current, )
for current := box.first; current != nil && current.prev != box; current = ui_box_tranverse_next_depth_first( current, parent_limit = box )
// for current := box.first; current != nil && current.prev != box; current = ui_box_tranverse_next_depth_first( current, parent_limit = box )
for current := box.first; current != nil && current.prev != box; current = ui_box_traverse_next_breadth_first( current )
{
if current == box do return
if current.computed.fresh do continue

View File

@ -190,7 +190,7 @@ test_whitespace_ast :: proc( default_layout : ^UI_Layout, frame_style_default :
// index := 0
widgets : Array(UI_Widget)
// widgets, alloc_error = array_init_reserve( UI_Widget, frame_slab_allocator(), 8 )
widgets, alloc_error = make( Array(UI_Widget), 4 * Kilobyte )
widgets, alloc_error = make( Array(UI_Widget), 8 * Kilobyte )
widgets_ptr := & widgets
label_id := 0

View File

@ -235,7 +235,7 @@ ui_resizable_end :: proc( resizable : ^UI_Resizable, pos, size : ^Vec2 ) {
}
// Adds resizable handles to a widget
ui_resizable_handles :: proc( parent : ^UI_Widget, pos : ^Vec2, size : ^Vec2,
ui_resizable_handles :: #force_no_inline proc( parent : ^UI_Widget, pos : ^Vec2, size : ^Vec2,
handle_width : f32 = 15,
theme : ^UI_Theme = nil,
left := true,
@ -380,7 +380,7 @@ ui_resizable_handles :: proc( parent : ^UI_Widget, pos : ^Vec2, size : ^Vec2,
}
}
process_handle_drag :: proc ( handle : ^UI_Widget,
process_handle_drag :: #force_no_inline proc ( handle : ^UI_Widget,
direction : Vec2,
target_alignment : Vec2,
target_center_aligned : Vec2,
@ -497,7 +497,7 @@ ui_resizable_handles :: proc( parent : ^UI_Widget, pos : ^Vec2, size : ^Vec2,
if corner_bl do drag_signal |= process_handle_drag( & handle_corner_bl, { -1, -1 }, {1, 0}, { 0.5, -0.5}, pos, size, alignment )
}
if drag_signal && compute_layout do ui_box_compute_layout(parent)
// if drag_signal && compute_layout do ui_box_compute_layout(parent)
return
}
#endregion("Resizable")

View File

@ -201,8 +201,8 @@ push-location $path_root
# $build_args += $flag_micro_architecture_native
$build_args += $flag_use_separate_modules
$build_args += $flag_thread_count + $CoreCount_Physical
$build_args += $flag_optimize_none
# $build_args += $flag_optimize_minimal
# $build_args += $flag_optimize_none
$build_args += $flag_optimize_minimal
# $build_args += $flag_optimize_speed
# $build_args += $falg_optimize_aggressive
$build_args += $flag_debug