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:
parent
07a4504a9f
commit
0f2610010b
@ -39,6 +39,7 @@ namespace dxvk::hud {
|
|||||||
addItem<HudDeviceInfoItem>("devinfo", m_device);
|
addItem<HudDeviceInfoItem>("devinfo", m_device);
|
||||||
addItem<HudFpsItem>("fps");
|
addItem<HudFpsItem>("fps");
|
||||||
addItem<HudFrameTimeItem>("frametimes");
|
addItem<HudFrameTimeItem>("frametimes");
|
||||||
|
addItem<HudSubmissionStatsItem>("submissions", device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,4 +258,39 @@ namespace dxvk::hud {
|
|||||||
return position;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user