Elaztek Developer Hub
Blamite Game Engine - blam!  00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
bgfx_profiler.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
6 
11 {
12 public:
13  void Draw()
14  {
15  if (!show)
16  {
17  return;
18  }
19 
20  if (ImGui::Begin("bgfx Profiler", &show))
21  {
22  const bgfx::Stats* stats = bgfx::getStats();
23 
24  for (int i = 0; i < stats->numViews; i++)
25  {
26  bgfx::ViewStats view_stats = stats->viewStats[i];
27 
28  std::string header_title = std::string(view_stats.name) + "(" + std::to_string(view_stats.view) + ")";
29 
30  if (ImGui::CollapsingHeader(header_title.c_str()))
31  {
32  std::string cpu_begin_str = "cpu begin time: " + std::to_string(view_stats.cpuTimeBegin);
33  std::string cpu_end_str = "cpu end time : " + std::to_string(view_stats.cpuTimeEnd);
34  std::string gpu_begin_str = "gpu begin time: " + std::to_string(view_stats.gpuTimeBegin);
35  std::string gpu_end_str = "gpu end time : " + std::to_string(view_stats.gpuTimeEnd);
36  std::string gpu_frame_str = "gpu frame num : " + std::to_string(view_stats.gpuFrameNum);
37  std::string cpu_time_str = "cpu frame time: " + std::to_string(view_stats.cpuTimeEnd - view_stats.cpuTimeBegin);
38  std::string gpu_time_str = "gpu frame time: " + std::to_string(view_stats.gpuTimeEnd - view_stats.gpuTimeBegin);
39 
40  ImGui::Text(cpu_begin_str.c_str());
41  ImGui::Text(cpu_end_str.c_str());
42  ImGui::Text(gpu_begin_str.c_str());
43  ImGui::Text(gpu_end_str.c_str());
44  ImGui::Text(gpu_frame_str.c_str());
45  ImGui::Text(cpu_time_str.c_str());
46  ImGui::Text(gpu_time_str.c_str());
47  }
48  }
49  }
50  ImGui::End();
51  }
52 };
BlamImGuiWindow_BgfxProfilerInfo::Draw
void Draw()
Draws the contents of the group.
Definition: bgfx_profiler.hpp:13
BlamImGuiWindow::show
bool show
Controls whether or not the group should be shown. May not be used in all groups.
Definition: imgui.h:34
ImGui::End
IMGUI_API void End()
Definition: imgui.cpp:6016
rendering.h
BlamImGuiWindow
Class representing an ImGUI window.
Definition: imgui.h:31
ImGui::Begin
IMGUI_API bool Begin(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
Definition: imgui.cpp:5397
ImGui::CollapsingHeader
IMGUI_API bool CollapsingHeader(const char *label, ImGuiTreeNodeFlags flags=0)
Definition: imgui_widgets.cpp:5422
ImGui::Text
IMGUI_API void Text(const char *fmt,...) IM_FMTARGS(1)
Definition: imgui_widgets.cpp:238
BlamImGuiWindow_BgfxProfilerInfo
Class for the bgfx profiler window.
Definition: bgfx_profiler.hpp:10
imgui.h