diff --git a/code/sectr/engine/client_api.odin b/code/sectr/engine/client_api.odin index e84c893..c5c8467 100644 --- a/code/sectr/engine/client_api.odin +++ b/code/sectr/engine/client_api.odin @@ -230,14 +230,14 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem backend := sokol_gfx.query_backend() switch backend { - case .D3D11: logf("sokol_gfx: using D3D11 backend") - case .GLCORE, .GLES3: logf("sokol_gfx: using GL backend") + case .D3D11: logf("sokol_gfx: using D3D11 backend") + case .GLCORE, .GLES3: logf("sokol_gfx: using GL backend") - case .METAL_MACOS, .METAL_IOS, .METAL_SIMULATOR: - logf("sokol_gfx: using Metal backend") + case .METAL_MACOS, .METAL_IOS, .METAL_SIMULATOR: + logf("sokol_gfx: using Metal backend") - case .WGPU: logf("sokol_gfx: using WebGPU backend") - case .DUMMY: logf("sokol_gfx: using dummy backend") + case .WGPU: logf("sokol_gfx: using WebGPU backend") + case .DUMMY: logf("sokol_gfx: using dummy backend") } render_data.pass_actions.bg_clear_black.colors[0] = sokol_gfx.Color_Attachment_Action { @@ -328,8 +328,8 @@ startup :: proc( prof : ^SpallProfiler, persistent_mem, frame_mem, transient_mem ui_startup( & workspace.ui, cache_allocator = persistent_slab_allocator() ) } - 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/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()) alloc_error : AllocatorError; success : bool debug.lorem_content, success = os.read_entire_file( debug.path_lorem, persistent_slab_allocator() ) diff --git a/code/sectr/engine/render.odin b/code/sectr/engine/render.odin index 157d599..cef6124 100644 --- a/code/sectr/engine/render.odin +++ b/code/sectr/engine/render.odin @@ -257,7 +257,7 @@ render_mode_screenspace :: proc( screen_extent : Extents2, screen_ui : ^UI_State } if true { - state.config.font_size_canvas_scalar = 1 + state.config.font_size_canvas_scalar = 2 zoom_adjust_size := 16 * state.project.workspace.cam.zoom over_sample := zoom_adjust_size < 12 ? 1.0 : f32(state.config.font_size_canvas_scalar) debug_text("font_size_canvas_scalar: %v", config.font_size_canvas_scalar) @@ -319,7 +319,7 @@ render_text_layer :: proc( screen_extent : Vec2, ve_ctx : ^ve.Context, render : // 1. Do the glyph rendering pass // Glyphs are first rendered to an intermediate 2k x 512px R8 texture case .Glyph: - profile("VEFontCache: draw call: glyph") + // profile("VEFontCache: draw call: glyph") if num_indices == 0 && ! draw_call.clear_before_draw { continue } @@ -355,7 +355,7 @@ render_text_layer :: proc( screen_extent : Vec2, ve_ctx : ^ve.Context, render : // 2. Do the atlas rendering pass // A simple 16-tap box downsample shader is then used to blit from this intermediate texture to the final atlas location case .Atlas: - profile("VEFontCache: draw call: atlas") + // profile("VEFontCache: draw call: atlas") if num_indices == 0 && ! draw_call.clear_before_draw { continue } @@ -401,7 +401,7 @@ render_text_layer :: proc( screen_extent : Vec2, ve_ctx : ^ve.Context, render : continue } - profile("VEFontCache: draw call: target") + // profile("VEFontCache: draw call: target") pass := screen_pass pass.swapchain = sokol_glue.swapchain() @@ -465,7 +465,7 @@ render_ui_via_box_tree :: proc( root : ^UI_Box, screen_extent : Vec2, ve_ctx : ^ shape_enqueued : b32 = false previous_layer : i32 = 0 - for box := root.first; box != nil; box = ui_box_tranverse_next_depth_based( box ) + for box := root.first; box != nil; box = ui_box_tranverse_next_depth_first( box ) { if box.ancestors != previous_layer { if shape_enqueued do render_flush_gp() @@ -482,11 +482,11 @@ render_ui_via_box_tree :: proc( root : ^UI_Box, screen_extent : Vec2, ve_ctx : ^ using computed - profile("enqueue box") + // profile("enqueue box") GP_Render: { - profile("draw_shapes") + // profile("draw_shapes") if style.bg_color.a != 0 { draw_rect( bounds, style.bg_color ) @@ -552,14 +552,14 @@ render_ui_via_box_list :: proc( render_list : []UI_RenderBoxInfo, screen_extent already_passed_signal := id > 0 && render_list[ id - 1 ].layer_signal if !already_passed_signal && entry.layer_signal { - profile("render ui layer") + // profile("render ui layer") render_flush_gp() if text_enqueued do render_text_layer( screen_extent, ve_ctx, ve_render ) continue } using entry - profile("enqueue box") + // profile("enqueue box") GP_Render: { @@ -672,7 +672,7 @@ draw_text_string_pos_norm :: proc( content : string, id : FontID, size : f32, po // Draw text using a string and extent-based screen coordinates draw_text_string_pos_extent :: proc( content : string, id : FontID, size : f32, pos : Vec2, color := Color_White ) { - profile(#procedure) + // profile(#procedure) state := get_state(); using state screen_size := app_window.extent * 2 render_pos := screen_to_render_pos(pos) @@ -682,7 +682,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 cam_offset := Vec2 { diff --git a/code/sectr/ui/core/base.odin b/code/sectr/ui/core/base.odin index fc1fe56..3435fd3 100644 --- a/code/sectr/ui/core/base.odin +++ b/code/sectr/ui/core/base.odin @@ -225,7 +225,7 @@ ui_graph_build_end :: proc( ui : ^UI_State ) // Auto-layout and initial render_queue generation render_queue := array_to_slice(ui.render_queue) - for current := root.first; current != nil; current = ui_box_tranverse_next_depth_based( current ) + for current := root.first; current != nil; current = ui_box_tranverse_next_depth_first( current ) { if ! current.computed.fresh { ui_box_compute_layout( current ) diff --git a/code/sectr/ui/core/box.odin b/code/sectr/ui/core/box.odin index 0b71117..b66986f 100644 --- a/code/sectr/ui/core/box.odin +++ b/code/sectr/ui/core/box.odin @@ -118,7 +118,7 @@ ui_prev_cached_box :: #force_inline proc( box : ^UI_Box ) -> ^UI_Box { return hm // TODO(Ed): Rename to ui_box_tranverse_view_next // Traveral pritorizes immeidate children -ui_box_tranverse_next_depth_based :: #force_inline proc "contextless" ( box : ^ UI_Box, bypass_intersection_test := false ) -> (^ UI_Box) +ui_box_tranverse_next_depth_first :: #force_inline proc "contextless" ( box : ^ UI_Box, bypass_intersection_test := false ) -> (^ UI_Box) { using state := get_state() // If current has children, do them first @@ -151,7 +151,7 @@ ui_box_tranverse_next_depth_based :: #force_inline proc "contextless" ( box : ^ } // Traveral pritorizes traversing a "anestry layer" -ui_box_traverse_next_layer_based :: proc "contextless" ( box : ^UI_Box, bypass_intersection_test := false, ctx : ^UI_State = nil ) -> (^UI_Box) +ui_box_traverse_next_breadth_first :: proc "contextless" ( box : ^UI_Box, bypass_intersection_test := false, ctx : ^UI_State = nil ) -> (^UI_Box) { ctx := ctx if ctx == nil { diff --git a/code/sectr/ui/core/layout_compute.odin b/code/sectr/ui/core/layout_compute.odin index fcc2cce..82de63e 100644 --- a/code/sectr/ui/core/layout_compute.odin +++ b/code/sectr/ui/core/layout_compute.odin @@ -168,7 +168,7 @@ ui_box_compute_layout :: proc( box : ^UI_Box, { content_size := content_bounds.max - content_bounds.min text_pos : Vec2 - text_pos = content_bounds.min + { 0, 0 } + text_pos = content_bounds.min + { 0, text_size.y * 0.5 } text_pos += (content_size - text_size) * layout.text_alignment computed.text_size = text_size @@ -184,7 +184,7 @@ ui_compute_children_bounding_area :: proc ( box : ^UI_Box ) ui_box_compute_layout_children :: proc( box : ^UI_Box ) { - for current := box.first; current != nil && current.prev != box; current = ui_box_tranverse_next_depth_based( current ) + for current := box.first; current != nil && current.prev != box; current = ui_box_tranverse_next_depth_first( current ) { if current == box do return if current.computed.fresh do continue diff --git a/scripts/build.ps1 b/scripts/build.ps1 index f4c360f..b845a53 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -204,8 +204,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 diff --git a/scripts/helpers/incremental_checks.ps1 b/scripts/helpers/incremental_checks.ps1 index f221a75..5bd6b28 100644 --- a/scripts/helpers/incremental_checks.ps1 +++ b/scripts/helpers/incremental_checks.ps1 @@ -2,37 +2,37 @@ function check-FileForChanges { - param( - [Parameter(Mandatory=$true)] - [string]$path_file - ) + param( + [Parameter(Mandatory=$true)] + [string]$path_file + ) - if (-not (Test-Path $path_file -PathType Leaf)) { - Write-Error "The provided path is not a valid file: $path_file" - return $false - } - $file_name = Split-Path $path_file -Leaf - $path_csv = Join-Path $path_build ($file_name + "_file_hash.csv") + if (-not (Test-Path $path_file -PathType Leaf)) { + Write-Error "The provided path is not a valid file: $path_file" + return $false + } + $file_name = Split-Path $path_file -Leaf + $path_csv = Join-Path $path_build ($file_name + "_file_hash.csv") - $csv_file_hash = $null - if (Test-Path $path_csv) { - $csv_file_hash = Import-Csv $path_csv | Select-Object -ExpandProperty value - } + $csv_file_hash = $null + if (Test-Path $path_csv) { + $csv_file_hash = Import-Csv $path_csv | Select-Object -ExpandProperty value + } - $current_hash_info = Get-FileHash -Path $path_file -Algorithm MD5 - $current_file_hash = $current_hash_info.Hash + $current_hash_info = Get-FileHash -Path $path_file -Algorithm MD5 + $current_file_hash = $current_hash_info.Hash - # Save the current hash to the CSV - [PSCustomObject]@{ - name = $path_file - value = $current_file_hash - } | Export-Csv $path_csv -NoTypeInformation + # Save the current hash to the CSV + [PSCustomObject]@{ + name = $path_file + value = $current_file_hash + } | Export-Csv $path_csv -NoTypeInformation - if ($csv_file_hash -and $csv_file_hash -eq $current_file_hash) { - return $false - } else { - return $true - } + if ($csv_file_hash -and $csv_file_hash -eq $current_file_hash) { + return $false + } else { + return $true + } } # Check to see if the module has changed files since the last build diff --git a/scripts/helpers/ini.ps1 b/scripts/helpers/ini.ps1 index f4e1130..25d20b2 100644 --- a/scripts/helpers/ini.ps1 +++ b/scripts/helpers/ini.ps1 @@ -1,20 +1,20 @@ # This is meant to be used with build.ps1, and is not a standalone script. function Get-IniContent { param([ string]$filePath ) - $ini = @{} - $currentSection = $null - switch -regex -file $filePath + $ini = @{} + $currentSection = $null + switch -regex -file $filePath { - "^\[(.+)\]$" { - $currentSection = $matches[1].Trim() - $ini[$currentSection] = @{} - } - "^(.+?)\s*=\s*(.*)" { - $key, $value = $matches[1].Trim(), $matches[2].Trim() - if ($null -ne $currentSection) { - $ini[$currentSection][$key] = $value - } - } - } - return $ini + "^\[(.+)\]$" { + $currentSection = $matches[1].Trim() + $ini[$currentSection] = @{} + } + "^(.+?)\s*=\s*(.*)" { + $key, $value = $matches[1].Trim(), $matches[2].Trim() + if ($null -ne $currentSection) { + $ini[$currentSection][$key] = $value + } + } + } + return $ini }