mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-06 20:58:37 +01:00
[hud] Add HUD item for descriptor stats
This commit is contained in:
parent
d4a3b823a2
commit
c67481b904
4 changed files with 78 additions and 0 deletions
|
@ -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.
|
- `submissions`: Shows the number of command buffers submitted per frame.
|
||||||
- `drawcalls`: Shows the number of draw calls and render passes per frame.
|
- `drawcalls`: Shows the number of draw calls and render passes per frame.
|
||||||
- `pipelines`: Shows the total number of graphics and compute pipelines.
|
- `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.
|
- `memory`: Shows the amount of device memory allocated and used.
|
||||||
- `gpuload`: Shows estimated GPU load. May be inaccurate.
|
- `gpuload`: Shows estimated GPU load. May be inaccurate.
|
||||||
- `version`: Shows DXVK version.
|
- `version`: Shows DXVK version.
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace dxvk::hud {
|
||||||
addItem<HudSubmissionStatsItem>("submissions", -1, device);
|
addItem<HudSubmissionStatsItem>("submissions", -1, device);
|
||||||
addItem<HudDrawCallStatsItem>("drawcalls", -1, device);
|
addItem<HudDrawCallStatsItem>("drawcalls", -1, device);
|
||||||
addItem<HudPipelineStatsItem>("pipelines", -1, device);
|
addItem<HudPipelineStatsItem>("pipelines", -1, device);
|
||||||
|
addItem<HudDescriptorStatsItem>("descriptors", -1, device);
|
||||||
addItem<HudMemoryStatsItem>("memory", -1, device);
|
addItem<HudMemoryStatsItem>("memory", -1, device);
|
||||||
addItem<HudCsThreadItem>("cs", -1, device);
|
addItem<HudCsThreadItem>("cs", -1, device);
|
||||||
addItem<HudGpuLoadItem>("gpuload", -1, device);
|
addItem<HudGpuLoadItem>("gpuload", -1, device);
|
||||||
|
|
|
@ -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)
|
HudMemoryStatsItem::HudMemoryStatsItem(const Rc<DxvkDevice>& device)
|
||||||
: m_device(device), m_memory(device->adapter()->memoryProperties()) {
|
: m_device(device), m_memory(device->adapter()->memoryProperties()) {
|
||||||
|
|
||||||
|
|
|
@ -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
|
* \brief HUD item to display memory usage
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue