profiler track information UI testing

This commit is contained in:
jacob 2026-04-03 14:33:29 -05:00
parent 1a7794e81b
commit e33d09100c
6 changed files with 279 additions and 222 deletions

View File

@ -41,6 +41,7 @@ void AsyncWorkerEntryPoint(WaveLaneCtx *lane)
// Tick forever // Tick forever
for (;;) for (;;)
ProfZoneDF("Async Tick")
{ {
AsyncWorkerCtx *w = &Base.async.worker; AsyncWorkerCtx *w = &Base.async.worker;
{ {
@ -104,6 +105,5 @@ void AsyncWorkerEntryPoint(WaveLaneCtx *lane)
frame.arena = old_frame_arena; frame.arena = old_frame_arena;
} }
} }
} }
} }

View File

@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//~ Profile types //~ Profile types
#define ProfSamplesRingCap Kibi(256) #define ProfSamplesRingCap Mebi(8)
#define MaxRegisteredProfTracks Kibi(32) #define MaxRegisteredProfTracks Kibi(32)
Enum(ProfSampleFlag) Enum(ProfSampleFlag)

View File

@ -254,6 +254,7 @@ void GC_TickAsync(WaveLaneCtx *lane, AsyncFrameLaneCtx *base_async_lane_frame)
WaveSync(lane); WaveSync(lane);
if (async->cmds.count > 0) if (async->cmds.count > 0)
ProfZoneDF("Process glyph cache cmds")
{ {
////////////////////////////// //////////////////////////////
//- Rasterize glyphs //- Rasterize glyphs
@ -268,7 +269,11 @@ void GC_TickAsync(WaveLaneCtx *lane, AsyncFrameLaneCtx *base_async_lane_frame)
GC_Glyph *glyph = cmd->glyph; GC_Glyph *glyph = cmd->glyph;
ResourceKey resource = glyph->desc.font.r; ResourceKey resource = glyph->desc.font.r;
GC_GlyphDesc desc = glyph->desc; 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_size = desc.font_size;
glyph->font_ascent = ttf_result.font_ascent; glyph->font_ascent = ttf_result.font_ascent;
glyph->font_descent = ttf_result.font_descent; glyph->font_descent = ttf_result.font_descent;
@ -286,6 +291,7 @@ void GC_TickAsync(WaveLaneCtx *lane, AsyncFrameLaneCtx *base_async_lane_frame)
//- Allocate atlas slices //- Allocate atlas slices
if (lane->idx == 0) if (lane->idx == 0)
ProfZoneDF("Commit glyphs to atlas")
{ {
G_CommandListHandle cl = G_PrepareCommandList(G_QueueKind_AsyncCopy); G_CommandListHandle cl = G_PrepareCommandList(G_QueueKind_AsyncCopy);
for (u64 cmd_idx = 0; cmd_idx < async->cmds.count; ++cmd_idx) for (u64 cmd_idx = 0; cmd_idx < async->cmds.count; ++cmd_idx)

View File

@ -4269,6 +4269,7 @@ void G_D12_TickAsync(WaveLaneCtx *lane, AsyncFrameLaneCtx *base_async_lane_frame
// Release resources until we reach an uncompleted one // Release resources until we reach an uncompleted one
G_D12_Releasable *release = async->pending_releases.first; G_D12_Releasable *release = async->pending_releases.first;
if (release) if (release)
ProfZoneDF("Release D3D12 resource")
{ {
G_QueueCompletions completions = G_CompletionValuesFromQueues(G_QueueMask_All); G_QueueCompletions completions = G_CompletionValuesFromQueues(G_QueueMask_All);
while (release) while (release)

View File

@ -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 //- Build profiler panel
if (!TweakBool("Hide profiler", 1)) if (!TweakBool("Hide profiler", 0))
if (panel->flags & V_PanelFlag_Profiler) if (panel->flags & V_PanelFlag_Profiler)
ProfZoneDF("Build profiler panel") ProfZoneDF("Build profiler panel")
{ {
@ -3932,9 +3932,6 @@ void V_TickForever(WaveLaneCtx *lane)
} }
//- Build profiler //- Build profiler
UI_Key profiler_box = UI_KeyF("profiler"); UI_Key profiler_box = UI_KeyF("profiler");
UI_PushDF(Tag, profiler_box.v) UI_PushDF(Tag, profiler_box.v)
@ -4394,7 +4391,6 @@ void V_TickForever(WaveLaneCtx *lane)
// } // }
UI_BuildSpacer(window_padding, Axis_Y); UI_BuildSpacer(window_padding, Axis_Y);
UI_BuildDivider(UI_Px(1, 1), theme.col.divider, Axis_Y); UI_BuildDivider(UI_Px(1, 1), theme.col.divider, Axis_Y);
//- Graph //- Graph
@ -4409,6 +4405,11 @@ void V_TickForever(WaveLaneCtx *lane)
UI_BuildSpacer(window_padding, Axis_Y); UI_BuildSpacer(window_padding, Axis_Y);
//- Main area //- Main area
UI_SetNext(BackgroundColor, main_color_unsampled); UI_SetNext(BackgroundColor, main_color_unsampled);
UI_SetNext(Height, main_height); UI_SetNext(Height, main_height);
@ -4447,15 +4448,59 @@ void V_TickForever(WaveLaneCtx *lane)
} }
} }
UI_Size track_padding = UI_Px(window_padding.v * 2, 0);
//- Zone tracks //- Zone tracks
ProfZoneDF("Build zones") ProfZoneDF("Build zones")
{ {
for (VisTrack *vis_track = first_vis_track; vis_track; vis_track = vis_track->next) 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_SetNext(Height, track_height);
UI_PushDF(Tag, HashF("vis track %F", FmtUint(vis_track->id))) UI_PushDF(Tag, HashF("vis track %F", FmtUint(vis_track->id)))
UI_PushDF(Parent, UI_BuildRow())
{
UI_SetNext(Height, track_height);
UI_PushDF(Parent, UI_BuildColumn()) UI_PushDF(Parent, UI_BuildColumn())
{ {
// 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())
{
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_Px(10, 0), Axis_Y);
// UI_BuildSpacer(UI_Grow(1, 0), Axis_Y); // UI_BuildSpacer(UI_Grow(1, 0), Axis_Y);
@ -4674,6 +4719,9 @@ void V_TickForever(WaveLaneCtx *lane)
} }
} }
} }
}
}
}
@ -4963,18 +5011,18 @@ void V_TickForever(WaveLaneCtx *lane)
} }
} }
//- Test console panel //- Test profiler panel
{ {
V_Panel *parent = subroot_row_panel; V_Panel *parent = subroot_row_panel;
V_Panel *panel = PushStruct(perm, V_Panel); V_Panel *panel = PushStruct(perm, V_Panel);
panel->parent = parent; panel->parent = parent;
panel->axis = Axis_X; panel->axis = Axis_X;
DllQueuePush(parent->first, parent->last, panel); 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->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->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v));
panel->flags |= V_PanelFlag_Console; panel->flags |= V_PanelFlag_Profiler;
panel->pct = 0.75; panel->pct = 2;
} }
//- Vis screen panel //- 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 *parent = subroot_row_panel;
V_Panel *panel = PushStruct(perm, V_Panel); V_Panel *panel = PushStruct(perm, V_Panel);
panel->parent = parent; panel->parent = parent;
panel->axis = Axis_X; panel->axis = Axis_X;
DllQueuePush(parent->first, parent->last, panel); 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->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->resizer_box = UI_KeyF("panel resizer box %F", FmtUint(panel->box.v));
panel->flags |= V_PanelFlag_Profiler; panel->flags |= V_PanelFlag_Console;
panel->pct = 0.5; panel->pct = 0.25;
} }
} }

View File

@ -107,6 +107,7 @@ TTF_GlyphResult TTF_RasterizeGlyphFromCodepoint(Arena *arena, u32 codepoint, Res
Unlock(&lock); Unlock(&lock);
} }
if (!font) if (!font)
ProfZoneDF("Load & cache DirectWrite font")
{ {
Lock lock = LockE(&TTF_DW.font_bins_mutex); 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; f32 font_cap = font->design_metrics.capHeight * pixels_per_design_unit;
TTF_GlyphResult result = Zi; TTF_GlyphResult result = Zi;
ProfZoneDF("Rasterize")
{ {
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {