made the profiler list view a ui list
This commit is contained in:
parent
91b2b822f9
commit
8d737fd961
|
@ -119,13 +119,10 @@ Editor_DrawWidgetString(app_state* State, context* Context, render_command_buffe
|
|||
}
|
||||
|
||||
internal void
|
||||
Editor_DrawWidget(app_state* State, context* Context, render_command_buffer* RenderBuffer, ui_widget Widget)
|
||||
Editor_DrawWidget(app_state* State, context* Context, render_command_buffer* RenderBuffer, ui_widget Widget, rect2 ParentClipBounds)
|
||||
{
|
||||
rect2 WidgetParentUnion = Widget.Bounds;
|
||||
if (Widget.Parent)
|
||||
{
|
||||
WidgetParentUnion = Rect2Union(Widget.Bounds, Widget.Parent->Bounds);
|
||||
}
|
||||
WidgetParentUnion = Rect2Union(Widget.Bounds, ParentClipBounds);
|
||||
|
||||
if (!Widget.Parent || (Rect2Area(WidgetParentUnion) > 0))
|
||||
{
|
||||
|
@ -225,12 +222,12 @@ Editor_DrawWidget(app_state* State, context* Context, render_command_buffer* Ren
|
|||
|
||||
if (Widget.ChildrenRoot)
|
||||
{
|
||||
Editor_DrawWidget(State, Context, RenderBuffer, *Widget.ChildrenRoot);
|
||||
Editor_DrawWidget(State, Context, RenderBuffer, *Widget.ChildrenRoot, WidgetParentUnion);
|
||||
}
|
||||
|
||||
if (Widget.Next)
|
||||
{
|
||||
Editor_DrawWidget(State, Context, RenderBuffer, *Widget.Next);
|
||||
Editor_DrawWidget(State, Context, RenderBuffer, *Widget.Next, ParentClipBounds);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,12 +254,17 @@ TestRender(app_state* State, context* Context, render_command_buffer* RenderBuff
|
|||
ui_Label(&State->Interface, MakeString("Spacer"));
|
||||
ui_Label(&State->Interface, MakeString("Spacer"));
|
||||
|
||||
ui_BeginList(&State->Interface, MakeString("TestList"), 5, 4);
|
||||
ui_BeginList(&State->Interface, MakeString("TestList"), 5, 16);
|
||||
{
|
||||
ui_Button(&State->Interface, MakeString("B"));
|
||||
ui_Button(&State->Interface, MakeString("B"));
|
||||
ui_Button(&State->Interface, MakeString("B"));
|
||||
ui_Button(&State->Interface, MakeString("B"));
|
||||
ui_BeginRow(&State->Interface, 3);
|
||||
for (u32 i = 0; i < 16; i++)
|
||||
{
|
||||
|
||||
ui_Button(&State->Interface, MakeString("B"));
|
||||
ui_Button(&State->Interface, MakeString("C"));
|
||||
ui_Button(&State->Interface, MakeString("D"));
|
||||
}
|
||||
ui_EndRow(&State->Interface);
|
||||
}
|
||||
ui_EndList(&State->Interface);
|
||||
//ui_Button(&State->Interface, MakeString("B"));
|
||||
|
@ -334,7 +336,7 @@ Editor_Render(app_state* State, context* Context, render_command_buffer* RenderB
|
|||
PushRenderOrthographic(RenderBuffer, State->WindowBounds);
|
||||
PushRenderClearScreen(RenderBuffer);
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
TestRender(State, Context, RenderBuffer);
|
||||
#else
|
||||
ui_InterfaceReset(&State->Interface);
|
||||
|
@ -359,7 +361,7 @@ Editor_Render(app_state* State, context* Context, render_command_buffer* RenderB
|
|||
if (State->Interface.DrawOrderRoot != 0)
|
||||
{
|
||||
ui_widget Widget = *State->Interface.DrawOrderRoot;
|
||||
Editor_DrawWidget(State, Context, RenderBuffer, Widget);
|
||||
Editor_DrawWidget(State, Context, RenderBuffer, Widget, Context->WindowBounds);
|
||||
}
|
||||
|
||||
Context->GeneralWorkQueue->CompleteQueueWork(Context->GeneralWorkQueue, Context->ThreadContext);
|
||||
|
|
|
@ -110,6 +110,18 @@ RenderProfiler_ListVisualization(ui_interface* Interface, ui_widget* Layout, deb
|
|||
}
|
||||
ui_EndRow(Interface);
|
||||
|
||||
s32 CountedScopes = 0;
|
||||
for (s32 n = 0; n < VisibleFrame->ScopeNamesMax; n++)
|
||||
{
|
||||
scope_name NameEntry = VisibleFrame->ScopeNamesHash[n];
|
||||
if (NameEntry.Hash != 0)
|
||||
{
|
||||
CountedScopes += 1;
|
||||
}
|
||||
}
|
||||
|
||||
ui_BeginList(Interface, MakeString("Scope List"), 10, CountedScopes);
|
||||
ui_BeginRow(Interface, 5, &ColumnWidths[0]);
|
||||
for (s32 n = 0; n < VisibleFrame->ScopeNamesMax; n++)
|
||||
{
|
||||
scope_name NameEntry = VisibleFrame->ScopeNamesHash[n];
|
||||
|
@ -117,26 +129,24 @@ RenderProfiler_ListVisualization(ui_interface* Interface, ui_widget* Layout, deb
|
|||
{
|
||||
collated_scope_record* CollatedRecord = VisibleFrame->CollatedScopes + n;
|
||||
|
||||
ui_BeginRow(Interface, 5, &ColumnWidths[0]);
|
||||
{
|
||||
PrintF(&String, "%S", NameEntry.Name);
|
||||
ui_Label(Interface, String);
|
||||
|
||||
PrintF(&String, "%f%%", CollatedRecord->PercentFrameTime);
|
||||
ui_Label(Interface, String);
|
||||
|
||||
PrintF(&String, "%fs", CollatedRecord->TotalSeconds);
|
||||
ui_Label(Interface, String);
|
||||
|
||||
PrintF(&String, "%dcy", CollatedRecord->TotalCycles);
|
||||
ui_Label(Interface, String);
|
||||
|
||||
PrintF(&String, "%d", CollatedRecord->CallCount);
|
||||
ui_Label(Interface, String);
|
||||
}
|
||||
ui_EndRow(Interface);
|
||||
PrintF(&String, "%S", NameEntry.Name);
|
||||
ui_Label(Interface, String);
|
||||
|
||||
PrintF(&String, "%f%%", CollatedRecord->PercentFrameTime);
|
||||
ui_Label(Interface, String);
|
||||
|
||||
PrintF(&String, "%fs", CollatedRecord->TotalSeconds);
|
||||
ui_Label(Interface, String);
|
||||
|
||||
PrintF(&String, "%dcy", CollatedRecord->TotalCycles);
|
||||
ui_Label(Interface, String);
|
||||
|
||||
PrintF(&String, "%d", CollatedRecord->CallCount);
|
||||
ui_Label(Interface, String);
|
||||
}
|
||||
}
|
||||
ui_EndRow(Interface);
|
||||
ui_EndList(Interface);
|
||||
}
|
||||
|
||||
GSMetaTag(panel_render);
|
||||
|
|
|
@ -54,6 +54,7 @@ struct debug_frame
|
|||
s64 FrameEndCycles;
|
||||
|
||||
s32 ScopeNamesMax;
|
||||
s32 ScopeNamesCount;
|
||||
scope_name* ScopeNamesHash;
|
||||
|
||||
s32 ThreadCount;
|
||||
|
@ -302,6 +303,7 @@ EndDebugFrame (debug_services* Services)
|
|||
CollateThreadScopeCalls(ClosingFrame->ThreadCalls + t, ClosingFrame);
|
||||
}
|
||||
|
||||
s32 ScopeNamesCount = 0;
|
||||
for (s32 n = 0; n < ClosingFrame->ScopeNamesMax; n++)
|
||||
{
|
||||
if (ClosingFrame->ScopeNamesHash[n].Hash != 0)
|
||||
|
@ -310,8 +312,10 @@ EndDebugFrame (debug_services* Services)
|
|||
CollatedRecord->TotalSeconds = (r32)CollatedRecord->TotalCycles / (r32)Services->PerformanceCountFrequency;
|
||||
CollatedRecord->PercentFrameTime = (r32)CollatedRecord->TotalCycles / (r32)FrameTotalCycles;
|
||||
CollatedRecord->AverageSecondsPerCall = CollatedRecord->TotalSeconds / CollatedRecord->CallCount;
|
||||
ScopeNamesCount += 1;
|
||||
}
|
||||
}
|
||||
ClosingFrame->ScopeNamesCount = ScopeNamesCount;
|
||||
|
||||
Services->CurrentDebugFrame = (Services->CurrentDebugFrame + 1) % DEBUG_FRAME_COUNT;
|
||||
StartDebugFrame(&Services->Frames[Services->CurrentDebugFrame], Services);
|
||||
|
|
Loading…
Reference in New Issue