Unravel Engine C++ Reference
Loading...
Searching...
No Matches
statistics_panel.h
Go to the documentation of this file.
1#pragma once
3
4#include <base/basetypes.hpp>
5#include <context/context.hpp>
6
7// Forward declarations
8namespace bgfx { struct Stats; }
9struct ImGuiIO;
10
11namespace unravel
12{
13
14//-----------------------------------------------------------------------------
19//-----------------------------------------------------------------------------
21{
22public:
23 //-----------------------------------------------------------------------------
28 //-----------------------------------------------------------------------------
29 auto init(rtti::context& ctx) -> void;
30
31 //-----------------------------------------------------------------------------
36 //-----------------------------------------------------------------------------
37 auto deinit(rtti::context& ctx) -> void;
38
39 //-----------------------------------------------------------------------------
45 //-----------------------------------------------------------------------------
46 auto on_frame_update(rtti::context& ctx, delta_t dt) -> void;
47
48 //-----------------------------------------------------------------------------
54 //-----------------------------------------------------------------------------
55 auto on_frame_render(rtti::context& ctx, delta_t dt) -> void;
56
57 //-----------------------------------------------------------------------------
63 //-----------------------------------------------------------------------------
64 auto on_frame_ui_render(rtti::context& ctx, const char* name) -> void;
65
66 //-----------------------------------------------------------------------------
71 //-----------------------------------------------------------------------------
72 auto set_visible(bool visible) -> void
73 {
74 is_visible_ = visible;
75 }
76
77 //-----------------------------------------------------------------------------
82 //-----------------------------------------------------------------------------
83 auto is_visible() const -> bool
84 {
85 return is_visible_;
86 }
87
88private:
89 //-----------------------------------------------------------------------------
94 //-----------------------------------------------------------------------------
95 auto draw_menubar(rtti::context& ctx) -> void;
96
97 //-----------------------------------------------------------------------------
102 //-----------------------------------------------------------------------------
103 auto draw_statistics_content() -> void;
104
105 //-----------------------------------------------------------------------------
110 //-----------------------------------------------------------------------------
111 auto draw_frame_statistics(float overlay_width) -> void;
112
113 //-----------------------------------------------------------------------------
118 //-----------------------------------------------------------------------------
119 auto draw_profiler_section() -> void;
120
121 //-----------------------------------------------------------------------------
126 //-----------------------------------------------------------------------------
127 auto draw_memory_info_section(float overlay_width) -> void;
128
129 //-----------------------------------------------------------------------------
133 //-----------------------------------------------------------------------------
134 auto draw_resources_section() -> void;
135
136 // Helper methods for updating and drawing specific components
137 auto update_sample_data() -> void;
138 auto get_draw_call_breakdown(const gfx::stats* stats, std::uint32_t& scene_calls, std::uint32_t& editor_calls, std::uint32_t& total_calls) -> void;
139 auto draw_primitive_counts(const gfx::stats* stats, const ImGuiIO& io) -> void;
140 auto draw_call_counts(const gfx::stats* stats, const ImGuiIO& io) -> void;
141 auto draw_profiler_bars(const gfx::stats* stats) -> void;
142 auto draw_app_profiler_data() -> void;
143 auto draw_encoder_stats(const gfx::stats* stats, float item_height, float item_height_with_spacing, double to_cpu_ms) -> void;
144 auto draw_view_stats(const gfx::stats* stats, float item_height, float item_height_with_spacing, double to_cpu_ms, double to_gpu_ms) -> void;
145 auto draw_gpu_memory_section(const gfx::stats* stats, int64_t& gpu_memory_max, float overlay_width) -> void;
146 auto draw_render_target_memory_section(const gfx::stats* stats, int64_t& gpu_memory_max, float overlay_width) -> void;
147 auto draw_texture_memory_section(const gfx::stats* stats, int64_t& gpu_memory_max, float overlay_width) -> void;
148
149 bool is_visible_{false};
150 bool enable_gpu_profiler_{false};
151 bool show_editor_stats_{false}; // Disabled by default to focus on scene stats
152};
153
154} // namespace unravel
Panel that displays real-time performance statistics, profiler data, memory usage,...
auto on_frame_ui_render(rtti::context &ctx, const char *name) -> void
Render the statistics panel UI.
auto on_frame_update(rtti::context &ctx, delta_t dt) -> void
Update the statistics panel logic each frame.
auto is_visible() const -> bool
Check if the panel is currently visible.
auto deinit(rtti::context &ctx) -> void
Deinitialize the statistics panel and clean up resources.
auto set_visible(bool visible) -> void
Set the visibility state of the panel.
auto init(rtti::context &ctx) -> void
Initialize the statistics panel.
auto on_frame_render(rtti::context &ctx, delta_t dt) -> void
Render the statistics panel each frame.
std::chrono::duration< float > delta_t
std::string name
Definition hub.cpp:27
Definition mesh.cpp:14
bgfx::Stats stats
Definition graphics.h:30