diff --git a/src/pp/pp_vis/pp_vis_core.c b/src/pp/pp_vis/pp_vis_core.c index 48354678..b41e2a3a 100644 --- a/src/pp/pp_vis/pp_vis_core.c +++ b/src/pp/pp_vis/pp_vis_core.c @@ -628,8 +628,9 @@ V_WidgetTheme V_GetWidgetTheme(void) theme.col.button_active = Rgb32(0x0078a6); theme.col.button_selected = Rgb32(0x00668D); - theme.col.positive = VEC4(0.25, 0.5, 0.25, 1); - theme.col.negative = VEC4(0.5, 0.25, 0.25, 1); + theme.col.positive = VEC4(0.25, 0.50, 0.25, 1); + theme.col.negative = VEC4(0.50, 0.25, 0.25, 1); + theme.col.warn = VEC4(0.60, 0.60, 0.25, 1); theme.col.text = Rgb32(0xffdddee0); // theme.col.hint = Rgb32(0xff71767f); @@ -5467,6 +5468,7 @@ void V_TickForever(WaveLaneCtx *lane) //- Build profiler UI_Key profiler_box = UI_KeyF("profiler"); + ProfZoneDF("Build profiler") UI_SetDF(Tag, profiler_box.v) UI_SetDF(Parent, profiler_box) { @@ -5687,7 +5689,7 @@ void V_TickForever(WaveLaneCtx *lane) // u64 zone_idx = 0; u64 depth = 0; - for (u64 sample_seq = 0; sample_seq < samples_end_seq; ++sample_seq) + for (u64 sample_seq = samples_start_seq; sample_seq < samples_end_seq; ++sample_seq) { ProfSample *sample = &samples[sample_seq % ProfTrackSamplesCap]; @@ -5743,6 +5745,7 @@ void V_TickForever(WaveLaneCtx *lane) zone_track->zone_rows = PushStructs(frame->arena, V_ZoneRow, zone_track->zone_rows_count); for (V_ZoneDesc *zone = zone_track->first_zone; zone; zone = zone->next) { + // FIXME: Large depth V_ZoneRow *row = &zone_track->zone_rows[zone->depth]; row->count += 1; DllQueuePushNP(row->first_zone, row->last_zone, zone, next_in_row, prev_in_row); @@ -6028,71 +6031,77 @@ void V_TickForever(WaveLaneCtx *lane) //- Timeline tooltop { - UI_Key tooltip_box = UI_KeyF("tooltip"); - Vec2 tooltip_pos = SubVec2(frame->screen_cursor, UI_Anchor(main_box)); - tooltip_pos = AddVec2(tooltip_pos, theme.tooltip_offset_px); - f32 tooltip_opacity = 0.95; - - - // UI_Key tooltip_box = UI_KeyF("tooltip"); - // Vec2 main_cursor_pos = SubVec2(frame->screen_cursor, UI_Anchor(main_box)); - // tooltip_pos = AddVec2(tooltip_pos, theme.tooltip_offset_px); - // Vec2 tooltip_pos = VEC2(main_cursor_pos.x, main_cursor_pos.y); - // Vec2 tooltip_pos = VEC2(main_cursor_pos.x, UI_Rect(hovered_zone_box).p0.y - UI_Rect(main_box).p0.y); - // f32 tooltip_opacity = 0.75; - - - - UI_SetNext(Opacity, tooltip_opacity); - UI_SetNext(BackgroundColor, theme.col.window_bg); - UI_SetNext(BorderColor, theme.col.window_bd); - UI_SetNext(Rounding, UI_Rpx(theme.rounding * 5)); - UI_SetNext(BorderSize, 1); - // UI_SetNext(Width, UI_Fnt(15, 0)); - // UI_SetNext(Height, UI_Fnt(15, 0)); - UI_SetNext(Anchor, UI_Region_TopLeft); - UI_SetNext(FloatingPos, tooltip_pos); - UI_SetNext(Flags, UI_BoxFlag_Floating); - UI_SetDF(Width, UI_Shrink(0, 1)) - UI_SetDF(Height, UI_Shrink(0, 1)) - UI_SetDF(Parent, UI_BuildRowEx(tooltip_box)) + b32 show_ruler_time = is_measuring && ruler_len_ns != 0; + b32 show_hovered_zone = hovered_zone != 0; + if (show_ruler_time || show_hovered_zone) { - UI_BuildSpacer(window_padding, Axis_X); + UI_Key tooltip_box = UI_KeyF("tooltip"); + Vec2 tooltip_pos = SubVec2(frame->screen_cursor, UI_Anchor(main_box)); + tooltip_pos = AddVec2(tooltip_pos, theme.tooltip_offset_px); + f32 tooltip_opacity = 0.95; - UI_SetNext(Width, UI_Shrink(0, 1)); - UI_SetNext(Height, UI_Shrink(0, 1)); - UI_SetDF(Parent, UI_BuildColumn()) + + // UI_Key tooltip_box = UI_KeyF("tooltip"); + // Vec2 main_cursor_pos = SubVec2(frame->screen_cursor, UI_Anchor(main_box)); + // tooltip_pos = AddVec2(tooltip_pos, theme.tooltip_offset_px); + // Vec2 tooltip_pos = VEC2(main_cursor_pos.x, main_cursor_pos.y); + // Vec2 tooltip_pos = VEC2(main_cursor_pos.x, UI_Rect(hovered_zone_box).p0.y - UI_Rect(main_box).p0.y); + // f32 tooltip_opacity = 0.75; + + + + UI_SetNext(Opacity, tooltip_opacity); + UI_SetNext(BackgroundColor, theme.col.window_bg); + UI_SetNext(BorderColor, theme.col.window_bd); + UI_SetNext(Rounding, UI_Rpx(theme.rounding * 5)); + UI_SetNext(BorderSize, 1); + // UI_SetNext(Width, UI_Fnt(15, 0)); + // UI_SetNext(Height, UI_Fnt(15, 0)); + UI_SetNext(Anchor, UI_Region_TopLeft); + UI_SetNext(FloatingPos, tooltip_pos); + UI_SetNext(Flags, UI_BoxFlag_Floating); + UI_SetDF(Width, UI_Shrink(0, 1)) + UI_SetDF(Height, UI_Shrink(0, 1)) + UI_SetDF(Parent, UI_BuildRowEx(tooltip_box)) { - UI_BuildSpacer(window_padding, Axis_Y); + UI_BuildSpacer(window_padding, Axis_X); - if (is_measuring && ruler_len_ns != 0) + UI_SetNext(Width, UI_Shrink(0, 1)); + UI_SetNext(Height, UI_Shrink(0, 1)); + UI_SetDF(Parent, UI_BuildColumn()) { - UI_SetNext(TextColor, theme.col.positive); - UI_BuildLabelF("%F", FmtTimeNs(ruler_len_ns, .p = 3)); - } + UI_BuildSpacer(window_padding, Axis_Y); - if (hovered_zone) - { - V_ZoneDesc *zone = hovered_zone; - // UI_BuildLabelF("Hi!!"); - i64 zone_elapsed_ns = zone->end_ns - zone->start_ns; - - - - // UI_BuildLabelF("%Fms", FmtFloat(MsFromNs(zone_elapsed_ns), .p = 3)); - UI_SetDF(Parent, UI_BuildRow()) + if (show_ruler_time) { - UI_SetNext(TextColor, theme.col.hint); - UI_BuildLabelF("%F: ", FmtString(zone->name)); - - UI_BuildLabelF("%F", FmtTimeNs(zone_elapsed_ns, .p = 3)); - + // UI_SetNext(TextColor, theme.col.positive); + // UI_SetNext(TextColor, theme.col.button_active); + UI_BuildLabelF("%F", FmtTimeNs(ruler_len_ns, .p = 3)); } - } - UI_BuildSpacer(window_padding, Axis_Y); + if (show_hovered_zone) + { + V_ZoneDesc *zone = hovered_zone; + // UI_BuildLabelF("Hi!!"); + i64 zone_elapsed_ns = zone->end_ns - zone->start_ns; + + + + // UI_BuildLabelF("%Fms", FmtFloat(MsFromNs(zone_elapsed_ns), .p = 3)); + UI_SetDF(Parent, UI_BuildRow()) + { + UI_SetNext(TextColor, theme.col.hint); + UI_BuildLabelF("%F: ", FmtString(zone->name)); + + UI_BuildLabelF("%F", FmtTimeNs(zone_elapsed_ns, .p = 3)); + + } + } + + UI_BuildSpacer(window_padding, Axis_Y); + } + UI_BuildSpacer(window_padding, Axis_X); } - UI_BuildSpacer(window_padding, Axis_X); } } } @@ -6104,13 +6113,22 @@ void V_TickForever(WaveLaneCtx *lane) UI_SetDF(ChildAlignment, UI_Region_Center) UI_SetDF(Parent, UI_BuildRow()) { - UI_BuildSpacer(UI_Grow(1, 0), Axis_X); - - if (do_break) + if (IsUnoptimized) { - UI_ForceNext(DebugBreakFlags, UI_DebugBreakFlag_PrepLayout); + UI_SetDF(Width, UI_Shrink(0, 1)) + UI_SetDF(Height, UI_Shrink(0, 1)) + UI_SetDF(ChildAlignment, UI_Region_Left) + UI_SetDF(TextColor, theme.col.warn) + UI_SetDF(Parent, UI_BuildRow()) + { + // UI_BuildIcon(theme.icon_font, UI_Icon_Warning); + UI_BuildIcon(theme.icon_font, UI_Icon_Info); + UI_BuildLabelF(" Profiling an unoptimized build"); + } } + // Right side text + UI_BuildSpacer(UI_Grow(1, 0), Axis_X); UI_SetNext(Opacity, UI_Hot(main_box)); UI_BuildLabelF("%Fs", FmtFloat(SecondsFromNs(profiler->cursor_ns), .p = 3)); } diff --git a/src/pp/pp_vis/pp_vis_core.h b/src/pp/pp_vis/pp_vis_core.h index 7c8743b7..2a842676 100644 --- a/src/pp/pp_vis/pp_vis_core.h +++ b/src/pp/pp_vis/pp_vis_core.h @@ -67,6 +67,7 @@ Struct(V_WidgetTheme) Vec4 positive; Vec4 negative; + Vec4 warn; Vec4 text; Vec4 hint;