From e33d09100cf8a4a6617b165c37f9b71a7f8b16fe Mon Sep 17 00:00:00 2001 From: jacob Date: Fri, 3 Apr 2026 14:33:29 -0500 Subject: [PATCH] profiler track information UI testing --- src/base/base_async.c | 2 +- src/base/base_prof.h | 2 +- src/glyph_cache/glyph_cache.c | 8 +- src/gpu/gpu_dx12/gpu_dx12_core.c | 1 + src/pp/pp_vis/pp_vis_core.c | 486 +++++++++++++++++-------------- src/ttf/ttf_dwrite/ttf_dwrite.c | 2 + 6 files changed, 279 insertions(+), 222 deletions(-) diff --git a/src/base/base_async.c b/src/base/base_async.c index abda96fd..3410080c 100644 --- a/src/base/base_async.c +++ b/src/base/base_async.c @@ -41,6 +41,7 @@ void AsyncWorkerEntryPoint(WaveLaneCtx *lane) // Tick forever for (;;) + ProfZoneDF("Async Tick") { AsyncWorkerCtx *w = &Base.async.worker; { @@ -104,6 +105,5 @@ void AsyncWorkerEntryPoint(WaveLaneCtx *lane) frame.arena = old_frame_arena; } } - } } diff --git a/src/base/base_prof.h b/src/base/base_prof.h index f39bae49..a0901d59 100644 --- a/src/base/base_prof.h +++ b/src/base/base_prof.h @@ -1,7 +1,7 @@ //////////////////////////////////////////////////////////// //~ Profile types -#define ProfSamplesRingCap Kibi(256) +#define ProfSamplesRingCap Mebi(8) #define MaxRegisteredProfTracks Kibi(32) Enum(ProfSampleFlag) diff --git a/src/glyph_cache/glyph_cache.c b/src/glyph_cache/glyph_cache.c index e7653b5a..8fb8a13c 100644 --- a/src/glyph_cache/glyph_cache.c +++ b/src/glyph_cache/glyph_cache.c @@ -254,6 +254,7 @@ void GC_TickAsync(WaveLaneCtx *lane, AsyncFrameLaneCtx *base_async_lane_frame) WaveSync(lane); if (async->cmds.count > 0) + ProfZoneDF("Process glyph cache cmds") { ////////////////////////////// //- Rasterize glyphs @@ -268,7 +269,11 @@ void GC_TickAsync(WaveLaneCtx *lane, AsyncFrameLaneCtx *base_async_lane_frame) GC_Glyph *glyph = cmd->glyph; ResourceKey resource = glyph->desc.font.r; GC_GlyphDesc desc = glyph->desc; - TTF_GlyphResult ttf_result = TTF_RasterizeGlyphFromCodepoint(frame_arena, desc.codepoint, resource, desc.font_size); + TTF_GlyphResult ttf_result = Zi; + ProfZoneDF("Rasterize glyph") + { + ttf_result = TTF_RasterizeGlyphFromCodepoint(frame_arena, desc.codepoint, resource, desc.font_size); + } glyph->font_size = desc.font_size; glyph->font_ascent = ttf_result.font_ascent; glyph->font_descent = ttf_result.font_descent; @@ -286,6 +291,7 @@ void GC_TickAsync(WaveLaneCtx *lane, AsyncFrameLaneCtx *base_async_lane_frame) //- Allocate atlas slices if (lane->idx == 0) + ProfZoneDF("Commit glyphs to atlas") { G_CommandListHandle cl = G_PrepareCommandList(G_QueueKind_AsyncCopy); for (u64 cmd_idx = 0; cmd_idx < async->cmds.count; ++cmd_idx) diff --git a/src/gpu/gpu_dx12/gpu_dx12_core.c b/src/gpu/gpu_dx12/gpu_dx12_core.c index dfdae376..8a00d877 100644 --- a/src/gpu/gpu_dx12/gpu_dx12_core.c +++ b/src/gpu/gpu_dx12/gpu_dx12_core.c @@ -4269,6 +4269,7 @@ void G_D12_TickAsync(WaveLaneCtx *lane, AsyncFrameLaneCtx *base_async_lane_frame // Release resources until we reach an uncompleted one G_D12_Releasable *release = async->pending_releases.first; if (release) + ProfZoneDF("Release D3D12 resource") { G_QueueCompletions completions = G_CompletionValuesFromQueues(G_QueueMask_All); while (release) diff --git a/src/pp/pp_vis/pp_vis_core.c b/src/pp/pp_vis/pp_vis_core.c index 2bc21890..1a8bc736 100644 --- a/src/pp/pp_vis/pp_vis_core.c +++ b/src/pp/pp_vis/pp_vis_core.c @@ -3719,7 +3719,7 @@ void V_TickForever(WaveLaneCtx *lane) - b32 show_panels = (frame->is_editing && !hide_editor_ui) || TweakBool("Show panels when not editing", 1); + b32 show_panels = (frame->is_editing && !hide_editor_ui) || TweakBool("Show panels when not editing", 0); @@ -3882,7 +3882,7 @@ void V_TickForever(WaveLaneCtx *lane) ////////////////////////////// //- Build profiler panel - if (!TweakBool("Hide profiler", 1)) + if (!TweakBool("Hide profiler", 0)) if (panel->flags & V_PanelFlag_Profiler) ProfZoneDF("Build profiler panel") { @@ -3932,9 +3932,6 @@ void V_TickForever(WaveLaneCtx *lane) } - - - //- Build profiler UI_Key profiler_box = UI_KeyF("profiler"); UI_PushDF(Tag, profiler_box.v) @@ -4394,7 +4391,6 @@ void V_TickForever(WaveLaneCtx *lane) // } UI_BuildSpacer(window_padding, Axis_Y); - UI_BuildDivider(UI_Px(1, 1), theme.col.divider, Axis_Y); //- Graph @@ -4409,6 +4405,11 @@ void V_TickForever(WaveLaneCtx *lane) UI_BuildSpacer(window_padding, Axis_Y); + + + + + //- Main area UI_SetNext(BackgroundColor, main_color_unsampled); UI_SetNext(Height, main_height); @@ -4447,226 +4448,273 @@ void V_TickForever(WaveLaneCtx *lane) } } + UI_Size track_padding = UI_Px(window_padding.v * 2, 0); + //- Zone tracks ProfZoneDF("Build zones") { for (VisTrack *vis_track = first_vis_track; vis_track; vis_track = vis_track->next) { + // TODO: Real wave/lane information + String wave_name = Lit("Vis wave"); + u32 lane_idx = 2; + UI_SetNext(Height, track_height); UI_PushDF(Tag, HashF("vis track %F", FmtUint(vis_track->id))) - UI_PushDF(Parent, UI_BuildColumn()) + UI_PushDF(Parent, UI_BuildRow()) { - // UI_BuildSpacer(UI_Px(10, 0), Axis_Y); - // UI_BuildSpacer(UI_Grow(1, 0), Axis_Y); - - //- Zone rows - UI_Key *zone_row_boxes = PushStructs(frame->arena, UI_Key, vis_track->rows_count); - for (u64 zone_row_box_idx = 0; zone_row_box_idx < vis_track->rows_count; ++zone_row_box_idx) + UI_SetNext(Height, track_height); + UI_PushDF(Parent, UI_BuildColumn()) { - UI_Key zone_row_box = UI_KeyF("zone row %F", FmtUint(zone_row_box_idx)); - zone_row_boxes[zone_row_box_idx] = zone_row_box; - // UI_SetNext(Height, zone_height); - UI_SetNext(Height, zone_height); - UI_PushDF(Parent, UI_BuildRowEx(zone_row_box)) + // UI_BuildSpacer(track_padding, Axis_Y); + // UI_BuildSpacer(track_padding, Axis_Y); + // UI_BuildDivider(UI_Px(1, 1), theme.col.divider, Axis_Y); + + UI_SetNext(Height, track_height); + UI_PushDF(Parent, UI_BuildRow()) { - } - } - - //- Zones - for (VisZone *zone = vis_track->first_zone; zone; zone = zone->next) - { - UI_Key zone_row_box = zone_row_boxes[zone->depth - 1]; - b32 can_hover = profiler->unsnap; - - UI_Key zone_box = UI_KeyF("Zone %F", FmtUint(zone->id)); - b32 is_hovered = can_hover && UI_HoveredAbsolute(zone_box) && UI_HotAbsolute(main_box); - if (is_hovered) - { - hovered_zone_box = zone_box; - hovered_zone = zone; - } - f32 zone_hovered = can_hover * UI_Hovered(zone_box) * UI_Hot(main_box); - - f64 zone_offset_px = zone->start_px - view_start_px; - f64 zone_len_px = zone->end_px - zone->start_px; - - Vec2 zone_pos = VEC2(zone_offset_px, 0); - UI_Size zone_width = UI_Px(zone_len_px, 1); - - Vec4 zone_color = zone->color; - Vec4 zone_color_bd = zone_color; - - zone_color_bd = MulVec4(zone_color_bd, 0.65); - zone_color_bd.a = 1; - - Vec4 zone_text_color = UI_Top(TextColor); - zone_text_color.a *= 0.75; - - Vec4 zone_line_color = Zi; - - // b32 is_collapsed = zone->is_collapsed; - b32 is_collapsed = zone->collapsed_count > 0; - // b32 is_collapsed = zone->collapsed_count > 0 || zone_len_px <= min_zone_width_px; - - // UI_Size collapsed_line_size = UI_Px(2, 1); - UI_Size collapsed_line_size = UI_Px(1.5, 1); - // Vec4 collapsed_text_color = theme.col.positive; - // Vec4 collapsed_line_color = theme.col.negative; - // Vec4 collapsed_line_color = SrgbFromHsv(TweakFloat("RAAAAAAAAAH H", 100, 0, 360), TweakFloat("RAAAAAAAAAH S", 0.50, 0, 1), TweakFloat("RAAAAAAAAAH V", 1.00, 0, 1)); - // Vec4 collapsed_line_color = Color_Black; - // Vec4 collapsed_line_color = theme.col.hint; - // Vec4 collapsed_text_color = theme.col.positive; - // Vec4 collapsed_text_color = SrgbFromHsv(TweakFloat("RAAAAAAAAAH H", 100, 0, 360), TweakFloat("RAAAAAAAAAH S", 0.50, 0, 1), TweakFloat("RAAAAAAAAAH V", 1.00, 0, 1)); - - // Vec4 collapsed_line_color = SrgbFromHsv(32, 1, 0.5); - // Vec4 collapsed_text_color = SrgbFromHsv(32, 1, 1); - - // Vec4 collapsed_line_color = SrgbFromHsv(64, 1, 0.5); - // Vec4 collapsed_text_color = SrgbFromHsv(64, 1, 0.75); - - // collapsed_text_color = LerpSrgb(collapsed_text_color, Color_White, zone_hovered); - // collapsed_line_color = LerpSrgb(collapsed_line_color, Color_White, zone_hovered); - - - - - - String zone_text = zone->name; - if (is_collapsed) - { - zone_text = StringF(frame->arena, "%F", FmtUint(zone->collapsed_count)); - zone_text_color = collapsed_text_color; - zone_line_color = collapsed_line_color; - - // zone_color = VEC4(0, 0, 0, 0); - // zone_color = VEC4(1, 0, 1, 1); - // zone_color = VEC4(0.15, 0.15, 0.15, 0.5); - // zone_color = VEC4(0.20, 0.20, 0.20, 0.5); - - - zone_color = VEC4(0.25, 0.25, 0.25, 0.5); - - - // if (zone->collapsed_count > 1) - // { - // zone_color = VEC4(0.25, 0.25, 0.25, 0.5); - // } - // else - // { - // zone_color = Color_White; - // } - - - - // zone_color = VEC4(0.4, 0.4, 0.4, 0.5); - zone_color_bd = VEC4(0, 0, 0, 0); - - // zone_color = LerpSrgb(zone_color, Color_Transparent, zone_hovered); - - } - - if (zone_len_px < zone_name_hide_threshold_px) - { - zone_text.len = 0; - } - - zone_color_bd = LerpSrgb(zone_color_bd, Color_White, zone_hovered * !is_collapsed); - zone_text_color = LerpSrgb(zone_text_color, Color_White, zone_hovered); - zone_line_color = LerpSrgb(zone_line_color, Color_White, zone_hovered); - - - f32 collapsed_zones_per_px = zone->collapsed_count / zone_len_px; - // f32 zag_intensity = 50 / collapsed_zones_per_px; - // zag_intensity = MaxF32(zag_intensity, 5); - - // f32 top_zag_information_density = 10; - f32 top_zag_information_density = zone_collapse_threshold_px; - // f32 zag_intensity = SmoothstepF32(0, top_zag_information_density, collapsed_zones_per_px); - // f32 zag_intensity = 1; - f32 zag_intensity = 0.3; - // f32 zag_intensity = TweakFloat("RAAAAAAAAAAAAAH", 1, 0, 1); - - f32 period_max = 20; - f32 period_min = 5; - f32 zag_period = LerpF32(period_max, period_min, zag_intensity); - - f32 amplitude_max = UI_Top(FontSize) * 0.15; - f32 amplitude_min = UI_Top(FontSize) * 0.05; - f32 zag_amplitude = LerpF32(amplitude_max, amplitude_min, zag_intensity); - - UI_SetNext(Width, zone_width); - UI_SetNext(Height, UI_Grow(1, 0)); - UI_SetNext(BackgroundColor, zone_color); - UI_SetNext(BorderColor, zone_color_bd); - UI_SetNext(BorderSize, 1); - UI_SetNext(FloatingPos, zone_pos); - UI_SetNext(ChildAlignment, UI_Region_Center); - UI_SetNext( - Flags, - UI_BoxFlag_Floating | - UI_BoxFlag_DontClampFloatingX | - UI_BoxFlag_DontClampFloatingY | - UI_BoxFlag_CaptureMouse | - UI_BoxFlag_Scissor - ); - UI_SetNext(Parent, zone_row_box); - // UI_PushDF(OrFlags, UI_Top(OrFlags) | (UI_BoxFlag_DontTruncateText * !!(is_collapsed))) - // UI_PushDF(OmitFlags, UI_Top(OmitFlags) | (UI_BoxFlag_Scissor * !!(is_collapsed))) - // UI_PushDF(ZagPeriod, UI_Top(FontSize) * 1) - // UI_PushDF(ZagPeriod, (collapsed_zones_per_px * UI_Top(FontSize)) * 0.1) - // UI_PushDF(ZagPeriod, collapsed_zones_per_px / (UI_Top(FontSize) * 1)) - UI_PushDF(ZagPeriod, zag_period) - UI_PushDF(ZagThickness, 1.5) - UI_PushDF(ZagRoundness, 1) - UI_PushDF(ZagAmplitude, zag_amplitude) - UI_PushDF(Parent, UI_BuildRowEx(zone_box)) - { - if (is_collapsed) + UI_SetNext(Height, track_height); + UI_PushDF(Parent, UI_BuildColumn()) { - // Left zag - UI_SetNext(Width, UI_Grow(1, 0)); - UI_SetNext(ZagColor, zone_line_color); - UI_BuildBox(); - } - else - { - UI_SetNext(Width, UI_Px(3, 1)); - UI_BuildBox(); - } - - if (zone_text.len > 0) - { - // Zone name - // if (zone_len_px > zone_collapse_threshold_px * 3) + //- Wave/lane info { + // UI_SetNext(Height, zone_height); + UI_SetNext(Height, UI_Shrink(0, 1)); + // UI_SetNext(BackgroundColor, VEC4(0.15, 0.15, 0.15, 0.15)); + UI_SetNext(BackgroundColor, profiler_color); + // UI_SetNext(Text, wave_name); + UI_PushDF(Parent, UI_BuildRow()) + { + UI_PushDF(Height, UI_Shrink(0, 1)) + UI_PushDF(Width, UI_Shrink(0, 1)) + UI_PushDF(FontSize, UI_Top(FontSize) * theme.h4) + UI_PushDF(Flags, UI_BoxFlag_DrawText) + { + UI_PushDF(Text, Lit("Async ")) + // UI_PushDF(TextColor, theme.col.hint) + UI_BuildBox(); + + UI_PushDF(Text, Lit("(Lane 0)")) + UI_PushDF(TextColor, theme.col.hint) + UI_BuildBox(); + } + } + } + + // UI_BuildSpacer(UI_Px(10, 0), Axis_Y); + // UI_BuildSpacer(UI_Grow(1, 0), Axis_Y); + + //- Zone rows + UI_Key *zone_row_boxes = PushStructs(frame->arena, UI_Key, vis_track->rows_count); + for (u64 zone_row_box_idx = 0; zone_row_box_idx < vis_track->rows_count; ++zone_row_box_idx) + { + UI_Key zone_row_box = UI_KeyF("zone row %F", FmtUint(zone_row_box_idx)); + zone_row_boxes[zone_row_box_idx] = zone_row_box; + // UI_SetNext(Height, zone_height); + UI_SetNext(Height, zone_height); + UI_PushDF(Parent, UI_BuildRowEx(zone_row_box)) + { + } + } + + //- Zones + for (VisZone *zone = vis_track->first_zone; zone; zone = zone->next) + { + UI_Key zone_row_box = zone_row_boxes[zone->depth - 1]; + b32 can_hover = profiler->unsnap; + + UI_Key zone_box = UI_KeyF("Zone %F", FmtUint(zone->id)); + b32 is_hovered = can_hover && UI_HoveredAbsolute(zone_box) && UI_HotAbsolute(main_box); + if (is_hovered) + { + hovered_zone_box = zone_box; + hovered_zone = zone; + } + f32 zone_hovered = can_hover * UI_Hovered(zone_box) * UI_Hot(main_box); + + f64 zone_offset_px = zone->start_px - view_start_px; + f64 zone_len_px = zone->end_px - zone->start_px; + + Vec2 zone_pos = VEC2(zone_offset_px, 0); + UI_Size zone_width = UI_Px(zone_len_px, 1); + + Vec4 zone_color = zone->color; + Vec4 zone_color_bd = zone_color; + + zone_color_bd = MulVec4(zone_color_bd, 0.65); + zone_color_bd.a = 1; + + Vec4 zone_text_color = UI_Top(TextColor); + zone_text_color.a *= 0.75; + + Vec4 zone_line_color = Zi; + + // b32 is_collapsed = zone->is_collapsed; + b32 is_collapsed = zone->collapsed_count > 0; + // b32 is_collapsed = zone->collapsed_count > 0 || zone_len_px <= min_zone_width_px; + + // UI_Size collapsed_line_size = UI_Px(2, 1); + UI_Size collapsed_line_size = UI_Px(1.5, 1); + // Vec4 collapsed_text_color = theme.col.positive; + // Vec4 collapsed_line_color = theme.col.negative; + // Vec4 collapsed_line_color = SrgbFromHsv(TweakFloat("RAAAAAAAAAH H", 100, 0, 360), TweakFloat("RAAAAAAAAAH S", 0.50, 0, 1), TweakFloat("RAAAAAAAAAH V", 1.00, 0, 1)); + // Vec4 collapsed_line_color = Color_Black; + // Vec4 collapsed_line_color = theme.col.hint; + // Vec4 collapsed_text_color = theme.col.positive; + // Vec4 collapsed_text_color = SrgbFromHsv(TweakFloat("RAAAAAAAAAH H", 100, 0, 360), TweakFloat("RAAAAAAAAAH S", 0.50, 0, 1), TweakFloat("RAAAAAAAAAH V", 1.00, 0, 1)); + + // Vec4 collapsed_line_color = SrgbFromHsv(32, 1, 0.5); + // Vec4 collapsed_text_color = SrgbFromHsv(32, 1, 1); + + // Vec4 collapsed_line_color = SrgbFromHsv(64, 1, 0.5); + // Vec4 collapsed_text_color = SrgbFromHsv(64, 1, 0.75); + + // collapsed_text_color = LerpSrgb(collapsed_text_color, Color_White, zone_hovered); + // collapsed_line_color = LerpSrgb(collapsed_line_color, Color_White, zone_hovered); + + + + + + String zone_text = zone->name; if (is_collapsed) { - UI_SetNext(Width, UI_Shrink(0, 1)); - UI_SetNext(ChildAlignment, UI_Region_Center); - } - else - { - UI_SetNext(ChildAlignment, UI_Region_Left); - UI_SetNext(Width, UI_Grow(1, 0)); - } - UI_SetNext(FontSize, UI_Top(FontSize) * theme.h5); - UI_SetNext(TextColor, zone_text_color); - UI_SetNext(Text, zone_text); - UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_DontTruncateText); - UI_BuildRow(); - } + zone_text = StringF(frame->arena, "%F", FmtUint(zone->collapsed_count)); + zone_text_color = collapsed_text_color; + zone_line_color = collapsed_line_color; - // Right collapsed lines - if (is_collapsed) - { - UI_SetNext(Width, UI_Grow(1, 0)); - UI_SetNext(ZagColor, zone_line_color); - UI_BuildBox(); - } - else - { - UI_SetNext(Width, UI_Px(3, 1)); - UI_BuildBox(); + // zone_color = VEC4(0, 0, 0, 0); + // zone_color = VEC4(1, 0, 1, 1); + // zone_color = VEC4(0.15, 0.15, 0.15, 0.5); + // zone_color = VEC4(0.20, 0.20, 0.20, 0.5); + + + zone_color = VEC4(0.25, 0.25, 0.25, 0.5); + + + // if (zone->collapsed_count > 1) + // { + // zone_color = VEC4(0.25, 0.25, 0.25, 0.5); + // } + // else + // { + // zone_color = Color_White; + // } + + + + // zone_color = VEC4(0.4, 0.4, 0.4, 0.5); + zone_color_bd = VEC4(0, 0, 0, 0); + + // zone_color = LerpSrgb(zone_color, Color_Transparent, zone_hovered); + + } + + if (zone_len_px < zone_name_hide_threshold_px) + { + zone_text.len = 0; + } + + zone_color_bd = LerpSrgb(zone_color_bd, Color_White, zone_hovered * !is_collapsed); + zone_text_color = LerpSrgb(zone_text_color, Color_White, zone_hovered); + zone_line_color = LerpSrgb(zone_line_color, Color_White, zone_hovered); + + + f32 collapsed_zones_per_px = zone->collapsed_count / zone_len_px; + // f32 zag_intensity = 50 / collapsed_zones_per_px; + // zag_intensity = MaxF32(zag_intensity, 5); + + // f32 top_zag_information_density = 10; + f32 top_zag_information_density = zone_collapse_threshold_px; + // f32 zag_intensity = SmoothstepF32(0, top_zag_information_density, collapsed_zones_per_px); + // f32 zag_intensity = 1; + f32 zag_intensity = 0.3; + // f32 zag_intensity = TweakFloat("RAAAAAAAAAAAAAH", 1, 0, 1); + + f32 period_max = 20; + f32 period_min = 5; + f32 zag_period = LerpF32(period_max, period_min, zag_intensity); + + f32 amplitude_max = UI_Top(FontSize) * 0.15; + f32 amplitude_min = UI_Top(FontSize) * 0.05; + f32 zag_amplitude = LerpF32(amplitude_max, amplitude_min, zag_intensity); + + UI_SetNext(Width, zone_width); + UI_SetNext(Height, UI_Grow(1, 0)); + UI_SetNext(BackgroundColor, zone_color); + UI_SetNext(BorderColor, zone_color_bd); + UI_SetNext(BorderSize, 1); + UI_SetNext(FloatingPos, zone_pos); + UI_SetNext(ChildAlignment, UI_Region_Center); + UI_SetNext( + Flags, + UI_BoxFlag_Floating | + UI_BoxFlag_DontClampFloatingX | + UI_BoxFlag_DontClampFloatingY | + UI_BoxFlag_CaptureMouse | + UI_BoxFlag_Scissor + ); + UI_SetNext(Parent, zone_row_box); + // UI_PushDF(OrFlags, UI_Top(OrFlags) | (UI_BoxFlag_DontTruncateText * !!(is_collapsed))) + // UI_PushDF(OmitFlags, UI_Top(OmitFlags) | (UI_BoxFlag_Scissor * !!(is_collapsed))) + // UI_PushDF(ZagPeriod, UI_Top(FontSize) * 1) + // UI_PushDF(ZagPeriod, (collapsed_zones_per_px * UI_Top(FontSize)) * 0.1) + // UI_PushDF(ZagPeriod, collapsed_zones_per_px / (UI_Top(FontSize) * 1)) + UI_PushDF(ZagPeriod, zag_period) + UI_PushDF(ZagThickness, 1.5) + UI_PushDF(ZagRoundness, 1) + UI_PushDF(ZagAmplitude, zag_amplitude) + UI_PushDF(Parent, UI_BuildRowEx(zone_box)) + { + if (is_collapsed) + { + // Left zag + UI_SetNext(Width, UI_Grow(1, 0)); + UI_SetNext(ZagColor, zone_line_color); + UI_BuildBox(); + } + else + { + UI_SetNext(Width, UI_Px(3, 1)); + UI_BuildBox(); + } + + if (zone_text.len > 0) + { + // Zone name + // if (zone_len_px > zone_collapse_threshold_px * 3) + { + if (is_collapsed) + { + UI_SetNext(Width, UI_Shrink(0, 1)); + UI_SetNext(ChildAlignment, UI_Region_Center); + } + else + { + UI_SetNext(ChildAlignment, UI_Region_Left); + UI_SetNext(Width, UI_Grow(1, 0)); + } + UI_SetNext(FontSize, UI_Top(FontSize) * theme.h5); + UI_SetNext(TextColor, zone_text_color); + UI_SetNext(Text, zone_text); + UI_SetNext(Flags, UI_BoxFlag_DrawText | UI_BoxFlag_DontTruncateText); + UI_BuildRow(); + } + + // Right collapsed lines + if (is_collapsed) + { + UI_SetNext(Width, UI_Grow(1, 0)); + UI_SetNext(ZagColor, zone_line_color); + UI_BuildBox(); + } + else + { + UI_SetNext(Width, UI_Px(3, 1)); + UI_BuildBox(); + } + } + } } } } @@ -4963,18 +5011,18 @@ void V_TickForever(WaveLaneCtx *lane) } } - //- Test console panel + //- Test profiler panel { V_Panel *parent = subroot_row_panel; V_Panel *panel = PushStruct(perm, V_Panel); panel->parent = parent; panel->axis = Axis_X; DllQueuePush(parent->first, parent->last, panel); - panel->box = UI_KeyF("test raah console panel"); + panel->box = UI_KeyF("test raah profiler panel"); panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); - panel->flags |= V_PanelFlag_Console; - panel->pct = 0.75; + panel->flags |= V_PanelFlag_Profiler; + panel->pct = 2; } //- Vis screen panel @@ -4991,18 +5039,18 @@ void V_TickForever(WaveLaneCtx *lane) } - //- Test profiler panel + //- Test console panel { V_Panel *parent = subroot_row_panel; V_Panel *panel = PushStruct(perm, V_Panel); panel->parent = parent; panel->axis = Axis_X; DllQueuePush(parent->first, parent->last, panel); - panel->box = UI_KeyF("test raah profiler panel"); + panel->box = UI_KeyF("test raah console panel"); panel->contents_box = UI_KeyF("panel contents box %F", FmtUint(panel->box.v)); panel->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v)); - panel->flags |= V_PanelFlag_Profiler; - panel->pct = 0.5; + panel->flags |= V_PanelFlag_Console; + panel->pct = 0.25; } } diff --git a/src/ttf/ttf_dwrite/ttf_dwrite.c b/src/ttf/ttf_dwrite/ttf_dwrite.c index 434100e0..8c78b6ee 100644 --- a/src/ttf/ttf_dwrite/ttf_dwrite.c +++ b/src/ttf/ttf_dwrite/ttf_dwrite.c @@ -107,6 +107,7 @@ TTF_GlyphResult TTF_RasterizeGlyphFromCodepoint(Arena *arena, u32 codepoint, Res Unlock(&lock); } if (!font) + ProfZoneDF("Load & cache DirectWrite font") { Lock lock = LockE(&TTF_DW.font_bins_mutex); { @@ -179,6 +180,7 @@ TTF_GlyphResult TTF_RasterizeGlyphFromCodepoint(Arena *arena, u32 codepoint, Res f32 font_cap = font->design_metrics.capHeight * pixels_per_design_unit; TTF_GlyphResult result = Zi; + ProfZoneDF("Rasterize") { if (SUCCEEDED(hr)) {