1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[hud] Implement queue submission counter as a HUD item

This commit is contained in:
Philip Rebohle 2019-12-13 10:47:40 +01:00
parent 07a4504a9f
commit 0f2610010b
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
3 changed files with 63 additions and 0 deletions

View File

@ -39,6 +39,7 @@ namespace dxvk::hud {
addItem<HudDeviceInfoItem>("devinfo", m_device);
addItem<HudFpsItem>("fps");
addItem<HudFrameTimeItem>("frametimes");
addItem<HudSubmissionStatsItem>("submissions", device);
}

View File

@ -258,4 +258,39 @@ namespace dxvk::hud {
return position;
}
HudSubmissionStatsItem::HudSubmissionStatsItem(const Rc<DxvkDevice>& device)
: m_device(device) {
}
HudSubmissionStatsItem::~HudSubmissionStatsItem() {
}
void HudSubmissionStatsItem::update(dxvk::high_resolution_clock::time_point time) {
DxvkStatCounters counters = m_device->getStatCounters();
uint32_t currCounter = counters.getCtr(DxvkStatCounter::QueueSubmitCount);
m_diffCounter = currCounter - m_prevCounter;
m_prevCounter = currCounter;
}
HudPos HudSubmissionStatsItem::render(
HudRenderer& renderer,
HudPos position) {
position.y += 16.0f;
renderer.drawText(16.0f,
{ position.x, position.y },
{ 1.0f, 1.0f, 1.0f, 1.0f },
str::format("Queue submissions: ", m_diffCounter));
position.y += 8.0f;
return position;
}
}

View File

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