From dc575b9831b1bf742aea90e558d69aade6e5ec80 Mon Sep 17 00:00:00 2001 From: jacob Date: Fri, 3 Apr 2026 14:58:13 -0500 Subject: [PATCH] visual profiler track boxes --- src/pp/pp_vis/pp_vis_core.c | 139 ++++++++++++++++++++++-------------- 1 file changed, 87 insertions(+), 52 deletions(-) diff --git a/src/pp/pp_vis/pp_vis_core.c b/src/pp/pp_vis/pp_vis_core.c index 1a8bc736..75f43717 100644 --- a/src/pp/pp_vis/pp_vis_core.c +++ b/src/pp/pp_vis/pp_vis_core.c @@ -3933,9 +3933,9 @@ void V_TickForever(WaveLaneCtx *lane) //- Build profiler - UI_Key profiler_box = UI_KeyF("profiler"); - UI_PushDF(Tag, profiler_box.v) - UI_PushDF(Parent, profiler_box) + // UI_Key profiler_box = UI_KeyF("profiler"); + // // UI_PushDF(Tag, profiler_box.v) + // UI_PushDF(Parent, profiler_box) { UI_Key main_box = UI_KeyF("main"); @@ -3950,8 +3950,8 @@ void V_TickForever(WaveLaneCtx *lane) UI_Size main_height = UI_Grow(1, 0); UI_Size zone_height = UI_Fnt(1.25, 0); // UI_Size track_height = UI_Fnt(10, 0); - UI_Size track_height = UI_Grow(1, 0); - // UI_Size track_height = UI_Shrink(0, 0); + // UI_Size track_height = UI_Grow(1, 0); + UI_Size track_height = UI_Shrink(0, 0); f32 zone_text_padding_px = UI_Top(FontSize) * 0.2; // Vec2 old_main_dims = DimsFromRng2(UI_Rect(main_box)); @@ -4362,18 +4362,18 @@ void V_TickForever(WaveLaneCtx *lane) // main_color_sampled.g += 0.05; - UI_SetNext(Parent, vis_screen_box); - UI_SetNext(BorderColor, theme.col.window_bd); - UI_SetNext(BorderSize, 2); - UI_SetNext(BackgroundColor, profiler_color); - UI_SetNext(Rounding, UI_Rpx(10 * theme.rounding)); - UI_SetNext(Height, profiler_height); - UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); - UI_SetNext(Opacity, profiler_opacity); - UI_SetNext(Parent, panel->contents_box); - UI_PushDF(Width, UI_Grow(1, 0)) - UI_PushDF(Parent, UI_BuildColumnEx(profiler_box)) - UI_PushDF(Parent, UI_BuildRow()) + // UI_SetNext(Parent, vis_screen_box); + // UI_SetNext(BorderColor, theme.col.window_bd); + // UI_SetNext(BorderSize, 2); + // UI_SetNext(BackgroundColor, profiler_color); + // UI_SetNext(Rounding, UI_Rpx(10 * theme.rounding)); + // UI_SetNext(Height, profiler_height); + // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse); + // UI_SetNext(Opacity, profiler_opacity); + // UI_SetNext(Parent, panel->contents_box); + // UI_PushDF(Width, UI_Grow(1, 0)) + // UI_PushDF(Parent, UI_BuildColumnEx(profiler_box)) + // UI_PushDF(Parent, UI_BuildRow()) { UI_BuildSpacer(window_padding, Axis_X); UI_PushDF(Parent, UI_BuildColumn()) @@ -4411,7 +4411,7 @@ void V_TickForever(WaveLaneCtx *lane) //- Main area - UI_SetNext(BackgroundColor, main_color_unsampled); + // UI_SetNext(BackgroundColor, main_color_unsampled); UI_SetNext(Height, main_height); UI_SetNext(Rounding, UI_Rpx(5 * theme.rounding)); // UI_SetNext(Flags, UI_BoxFlag_CaptureMouse | UI_BoxFlag_CaptureThroughChildren | UI_BoxFlag_Scissor); @@ -4436,20 +4436,38 @@ void V_TickForever(WaveLaneCtx *lane) Vec4 aabg_color = main_color_sampled; - // Ruler rect - { - // UI_SetNext(BorderSize, 1); - // UI_SetNext(BorderColor, Color_White); - UI_SetNext(Width, aabg_width); - UI_SetNext(FloatingPos, aabg_pos); - UI_SetNext(BackgroundColor, aabg_color); - UI_SetNext(Flags, UI_BoxFlag_Floating); - UI_BuildBoxEx(UI_KeyF("active area background")); - } + // { + // // UI_SetNext(BorderSize, 1); + // // UI_SetNext(BorderColor, Color_White); + // UI_SetNext(Width, aabg_width); + // UI_SetNext(FloatingPos, aabg_pos); + // UI_SetNext(BackgroundColor, aabg_color); + // UI_SetNext(Flags, UI_BoxFlag_Floating); + // UI_BuildBoxEx(UI_KeyF("active area background")); + // } + + // { + // // UI_SetNext(BorderSize, 1); + // // UI_SetNext(BorderColor, Color_White); + // // UI_SetNext(BackgroundColor, timeline_cursor_color); + // UI_SetNext(BackgroundColor, Color_White); + // UI_SetNext(Width, UI_Px(2, 0)); + // // UI_SetNext(Width, timeline_cursor_width); + // UI_SetNext(FloatingPos, VEC2(aabg_cursor_offset_px + aabg_width.v, 0)); + // UI_SetNext(Anchor, UI_Region_Top); + // UI_SetNext(Flags, UI_BoxFlag_Floating | UI_BoxFlag_DontClampFloatingX); + // UI_BuildBoxEx(UI_KeyF("aabg start cursor")); + // } } UI_Size track_padding = UI_Px(window_padding.v * 2, 0); + + // FIXME: Remove this + theme.col.panel_bg = main_color_unsampled; + theme.col.panel_opacity = 1; + + //- Zone tracks ProfZoneDF("Build zones") { @@ -4466,40 +4484,49 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetNext(Height, track_height); UI_PushDF(Parent, UI_BuildColumn()) { + // UI_BuildSpacer(window_padding, Axis_Y); // UI_BuildSpacer(track_padding, Axis_Y); // UI_BuildSpacer(track_padding, Axis_Y); // UI_BuildDivider(UI_Px(1, 1), theme.col.divider, Axis_Y); + //- 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(BackgroundColor, Color_Transparent); + // 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_SetNext(Height, track_height); + UI_SetNext(Rounding, UI_Rpx(5)); + UI_SetNext(BackgroundColor, profiler_color); + UI_SetNext(BorderColor, theme.col.window_bd); + UI_SetNext(BorderSize, 1); UI_PushDF(Parent, UI_BuildRow()) { + // UI_BuildSpacer(window_padding, Axis_Y); + UI_SetNext(Height, track_height); UI_PushDF(Parent, UI_BuildColumn()) { - //- 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); @@ -4517,6 +4544,9 @@ void V_TickForever(WaveLaneCtx *lane) } } + // End-of-rows padding + UI_BuildSpacer(window_padding, Axis_Y); + //- Zones for (VisZone *zone = vis_track->first_zone; zone; zone = zone->next) { @@ -4717,7 +4747,10 @@ void V_TickForever(WaveLaneCtx *lane) } } } + + // UI_BuildSpacer(window_padding, Axis_Y); } + // UI_BuildSpacer(window_padding, Axis_Y); } } } @@ -4901,6 +4934,8 @@ void V_TickForever(WaveLaneCtx *lane) // UI_BuildSpacer(window_padding, Axis_Y); + UI_BuildDivider(UI_Px(1, 1), theme.col.divider, Axis_Y); + //- Footer UI_PushDF(Height, footer_height) UI_PushDF(ChildAlignment, UI_Region_Center)