[hud] Add HUD item for descriptor stats

This commit is contained in:
Philip Rebohle 2022-06-23 00:41:53 +02:00
parent d4a3b823a2
commit c67481b904
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
4 changed files with 78 additions and 0 deletions

View File

@ -81,6 +81,7 @@ The `DXVK_HUD` environment variable controls a HUD which can display the framera
- `submissions`: Shows the number of command buffers submitted per frame.
- `drawcalls`: Shows the number of draw calls and render passes per frame.
- `pipelines`: Shows the total number of graphics and compute pipelines.
- `descriptors`: Shows the number of descriptor pools and descriptor sets.
- `memory`: Shows the amount of device memory allocated and used.
- `gpuload`: Shows estimated GPU load. May be inaccurate.
- `version`: Shows DXVK version.

View File

@ -42,6 +42,7 @@ namespace dxvk::hud {
addItem<HudSubmissionStatsItem>("submissions", -1, device);
addItem<HudDrawCallStatsItem>("drawcalls", -1, device);
addItem<HudPipelineStatsItem>("pipelines", -1, device);
addItem<HudDescriptorStatsItem>("descriptors", -1, device);
addItem<HudMemoryStatsItem>("memory", -1, device);
addItem<HudCsThreadItem>("cs", -1, device);
addItem<HudGpuLoadItem>("gpuload", -1, device);

View File

@ -500,6 +500,55 @@ namespace dxvk::hud {
}
HudDescriptorStatsItem::HudDescriptorStatsItem(const Rc<DxvkDevice>& device)
: m_device(device) {
}
HudDescriptorStatsItem::~HudDescriptorStatsItem() {
}
void HudDescriptorStatsItem::update(dxvk::high_resolution_clock::time_point time) {
DxvkStatCounters counters = m_device->getStatCounters();
m_descriptorPoolCount = counters.getCtr(DxvkStatCounter::DescriptorPoolCount);
m_descriptorSetCount = counters.getCtr(DxvkStatCounter::DescriptorSetCount);
}
HudPos HudDescriptorStatsItem::render(
HudRenderer& renderer,
HudPos position) {
position.y += 16.0f;
renderer.drawText(16.0f,
{ position.x, position.y },
{ 1.0f, 0.25f, 0.5f, 1.0f },
"Descriptor pools:");
renderer.drawText(16.0f,
{ position.x + 216.0f, position.y },
{ 1.0f, 1.0f, 1.0f, 1.0f },
str::format(m_descriptorPoolCount));
position.y += 20.0f;
renderer.drawText(16.0f,
{ position.x, position.y },
{ 1.0f, 0.25f, 0.5f, 1.0f },
"Descriptor sets:");
renderer.drawText(16.0f,
{ position.x + 216.0f, position.y },
{ 1.0f, 1.0f, 1.0f, 1.0f },
str::format(m_descriptorSetCount));
position.y += 8.0f;
return position;
}
HudMemoryStatsItem::HudMemoryStatsItem(const Rc<DxvkDevice>& device)
: m_device(device), m_memory(device->adapter()->memoryProperties()) {

View File

@ -336,6 +336,33 @@ namespace dxvk::hud {
};
/**
* \brief HUD item to display descriptor stats
*/
class HudDescriptorStatsItem : public HudItem {
public:
HudDescriptorStatsItem(const Rc<DxvkDevice>& device);
~HudDescriptorStatsItem();
void update(dxvk::high_resolution_clock::time_point time);
HudPos render(
HudRenderer& renderer,
HudPos position);
private:
Rc<DxvkDevice> m_device;
uint64_t m_descriptorPoolCount = 0;
uint64_t m_descriptorSetCount = 0;
};
/**
* \brief HUD item to display memory usage
*/