1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +01:00

[hud] Implement pipeline stat display as a HUD item

This commit is contained in:
Philip Rebohle 2019-12-13 11:01:14 +01:00
parent 3de8499697
commit 3aff573bd4
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 70 additions and 0 deletions

View File

@ -41,6 +41,7 @@ namespace dxvk::hud {
addItem<HudFrameTimeItem>("frametimes"); addItem<HudFrameTimeItem>("frametimes");
addItem<HudSubmissionStatsItem>("submissions", device); addItem<HudSubmissionStatsItem>("submissions", device);
addItem<HudDrawCallStatsItem>("drawcalls", device); addItem<HudDrawCallStatsItem>("drawcalls", device);
addItem<HudPipelineStatsItem>("pipelines", device);
} }

View File

@ -346,4 +346,46 @@ namespace dxvk::hud {
return position; return position;
} }
HudPipelineStatsItem::HudPipelineStatsItem(const Rc<DxvkDevice>& device)
: m_device(device) {
}
HudPipelineStatsItem::~HudPipelineStatsItem() {
}
void HudPipelineStatsItem::update(dxvk::high_resolution_clock::time_point time) {
DxvkStatCounters counters = m_device->getStatCounters();
m_graphicsPipelines = counters.getCtr(DxvkStatCounter::PipeCountGraphics);
m_computePipelines = counters.getCtr(DxvkStatCounter::PipeCountCompute);
}
HudPos HudPipelineStatsItem::render(
HudRenderer& renderer,
HudPos position) {
std::string strGpCount = str::format("Graphics pipelines: ", m_graphicsPipelines);
std::string strCpCount = str::format("Compute pipelines: ", m_computePipelines);
position.y += 16.0f;
renderer.drawText(16.0f,
{ position.x, position.y },
{ 1.0f, 1.0f, 1.0f, 1.0f },
strGpCount);
position.y += 20.0f;
renderer.drawText(16.0f,
{ position.x, position.y },
{ 1.0f, 1.0f, 1.0f, 1.0f },
strCpCount);
position.y += 8.0f;
return position;
}
} }

View File

@ -269,4 +269,31 @@ namespace dxvk::hud {
}; };
/**
* \brief HUD item to display pipeline counts
*/
class HudPipelineStatsItem : public HudItem {
public:
HudPipelineStatsItem(const Rc<DxvkDevice>& device);
~HudPipelineStatsItem();
void update(dxvk::high_resolution_clock::time_point time);
HudPos render(
HudRenderer& renderer,
HudPos position);
private:
Rc<DxvkDevice> m_device;
uint64_t m_graphicsPipelines = 0;
uint64_t m_computePipelines = 0;
};
} }