2
3
4
5
9#include "Debugger/Perf/NsightPerfGPUProfilerHUD.h"
10#include "Render/Vulkan/VulkanRenderBackend.h"
15 const std::string& panelName ,
28
29
30 VkPhysicalDeviceMemoryBudgetPropertiesEXT memoryBudgetProperties{};
31 memoryBudgetProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT;
32 memoryBudgetProperties.pNext =
nullptr;
35
36
37 VkPhysicalDeviceMemoryProperties2 memoryProperties{};
38 memoryProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2;
39 memoryProperties.pNext = &memoryBudgetProperties;
42
43
44 vkGetPhysicalDeviceMemoryProperties2(VulkanRenderBackend::GetState().m_PhysicalDevice, &memoryProperties);
46 uint64_t nHeaps = memoryProperties.memoryProperties.memoryHeapCount;
47 VkDeviceSize usage = 0;
48 VkDeviceSize budget = 0;
50 for (uint64_t i = 0; i < nHeaps; i++)
52 usage += memoryBudgetProperties.heapUsage[i];
53 budget += memoryBudgetProperties.heapBudget[i];
57
58
61 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2.0f, 4.0f));
64
65
66 static std::string searchString;
67 static bool isEnableSearch =
false;
70
71
76 ImGui::PushItemWidth(m_PanelSize.x - ImGuiH::GetLineItemSize().x * 2.0f - ImGui::GetStyle().WindowPadding.x);
77 static char search[256] = {};
78 if (ImGui::InputTextWithHint(
"##",
ICON_TEXT(ICON_MD_SEARCH, Search), search, 128))
80 searchString = std::string(search);
81 if (searchString.size() == 0) isEnableSearch =
false;
82 else isEnableSearch =
true;
84 ImGui::PopItemWidth();
86 ImGui::SameLine(m_PanelSize.x - ImGuiH::GetLineItemSize().x * 2.0f);
87 ImGui::Button(ICON_MD_FILTER_ALT, ImGuiH::GetLineItemSize());
88 ImGui::SameLine(m_PanelSize.x - ImGuiH::GetLineItemSize().x * 1.0f);
89 ImGui::Button(ICON_MD_REORDER, ImGuiH::GetLineItemSize());
93 float columeWidth = ImGuiH::GetLineItemSize().x * 6.5f;
100 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
101 char buffer[256] = {};
102 ImGui::InputTextWithHint(
"##",
ICON_TEXT_ROW(
" ", ConvertBytestoString(usage).c_str()), buffer,
sizeof(buffer));
103 ImGui::PopItemWidth();
108 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
109 char buffer[256] = {};
110 ImGui::InputTextWithHint(
"##",
ICON_TEXT_ROW(
" ", ConvertBytestoString(budget).c_str()), buffer,
sizeof(buffer));
111 ImGui::PopItemWidth();
116 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
117 char buffer[256] = {};
118 ImGui::InputTextWithHint(
"##",
ICON_TEXT_ROW(
" ", std::to_string(nHeaps).c_str()), buffer,
sizeof(buffer));
119 ImGui::PopItemWidth();
129 for (
int i = 0; i < nHeaps; i++)
132 s <<
"Memory Heap Index: " << i;
136 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
137 char buffer[256] = {};
138 ImGui::InputTextWithHint(
"##",
ICON_TEXT_ROW(
" ", ConvertBytestoString(memoryBudgetProperties.heapUsage[i]).c_str()), buffer,
sizeof(buffer));
139 ImGui::PopItemWidth();
144 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
145 char buffer[256] = {};
146 ImGui::InputTextWithHint(
"##",
ICON_TEXT_ROW(
" ", ConvertBytestoString(memoryBudgetProperties.heapBudget[i]).c_str()), buffer,
sizeof(buffer));
147 ImGui::PopItemWidth();
152 ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x - ImGuiH::GetLineItemSize().x);
153 char buffer[256] = {};
154 ImGui::InputTextWithHint(
"##",
ICON_TEXT_ROW(
" ", ConvertMemoryFlagtoString(memoryProperties.memoryProperties.memoryHeaps[i].flags).c_str()), buffer,
sizeof(buffer));
155 ImGui::PopItemWidth();
163 ImGui::PopStyleVar();
166
167
175 if (bytes / 1024.0f < 1.0f)
177 std::stringstream ss;
178 ss << bytes <<
"bytes";
182 else if (bytes / 1024.0f / 1024.0f < 1.0f)
184 std::stringstream ss;
185 ss << bytes / 1024.0f <<
" KB";
189 else if (bytes / 1024.0f / 1024.0f / 1024.0f < 1.0f)
191 std::stringstream ss;
192 ss << bytes / 1024.0f / 1024.0f <<
" MB";
196 else if (bytes / 1024.0f / 1024.0f / 1024.0f / 1024.0f < 1.0f)
198 std::stringstream ss;
199 ss << bytes / 1024.0f / 1024.0f / 1024.0f <<
" GB";
205 std::stringstream ss;
206 ss << bytes / 1024.0f / 1024.0f / 1024.0f / 1024.0f <<
" TB";
218 case VK_MEMORY_HEAP_DEVICE_LOCAL_BIT:
219 return "Device Local";
220 case VK_MEMORY_HEAP_MULTI_INSTANCE_BIT:
221 return "Multiple Instance";
#define ICON_TEXT(icon, text)
#define ICON_TEXT_ROW(icon, text)
#define SPICES_PROFILE_ZONEN(...)
#define SPICES_PROFILE_ZONE
FrameInfo Class. This class defines the FrameInfo data.
static bool DrawResetIcon(const bool &isMove)
Draw Reset Icon.
static void DrawPropertyItem(const std::string &itemName, float columeWidth, std::function< void()> nameFunc, std::function< void()> valFunc)
Draw a single property.
static void DrawTreeTitle(const std::string &treeName, std::function< void()> optionFunc, std::function< void()> treeFunc)
Draw a stylized tree title bar.
The ImGuiH Class. This class defines helper function for slate render.
ImguiSlate(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function. Init with Slate's name.
This Class defines the basic behaves of specific slate. When we add an new Slate, we need inherit fro...
std::string ConvertBytestoString(uint64_t bytes)
Convert bytes to string(GB/MB/KB).
virtual void OnRender() override
This interface is called On SlateRenderer Render.
ImguiVideoMemoryRuntimeHUD(const std::string &panelName, FrameInfo &frameInfo)
Constructor Function.
std::string ConvertMemoryFlagtoString(VkMemoryHeapFlags flag)
Convert memory flags to string.