mostly formatting/name changes and other misc stuff

This commit is contained in:
2024-06-28 03:27:25 -04:00
parent 43415446b0
commit 12741a228d
8 changed files with 67 additions and 67 deletions

View File

@ -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() )

View File

@ -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 {

View File

@ -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 )

View File

@ -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 {

View File

@ -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