mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-15 07:29:17 +01:00
[hud] Implement compiler activity display as a HUD item
This commit is contained in:
parent
5d8ae8f988
commit
3415376984
@ -44,6 +44,7 @@ namespace dxvk::hud {
|
||||
addItem<HudPipelineStatsItem>("pipelines", device);
|
||||
addItem<HudMemoryStatsItem>("memory", device);
|
||||
addItem<HudGpuLoadItem>("gpuload", device);
|
||||
addItem<HudCompilerActivityItem>("compiler", device);
|
||||
}
|
||||
|
||||
|
||||
|
@ -477,4 +477,45 @@ namespace dxvk::hud {
|
||||
return position;
|
||||
}
|
||||
|
||||
|
||||
HudCompilerActivityItem::HudCompilerActivityItem(const Rc<DxvkDevice>& device)
|
||||
: m_device(device) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
HudCompilerActivityItem::~HudCompilerActivityItem() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
void HudCompilerActivityItem::update(dxvk::high_resolution_clock::time_point time) {
|
||||
DxvkStatCounters counters = m_device->getStatCounters();
|
||||
bool doShow = counters.getCtr(DxvkStatCounter::PipeCompilerBusy);
|
||||
|
||||
if (!doShow) {
|
||||
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(time - m_timeShown);
|
||||
doShow = elapsed.count() <= MinShowDuration;
|
||||
}
|
||||
|
||||
if (doShow && !m_show)
|
||||
m_timeShown = time;
|
||||
|
||||
m_show = doShow;
|
||||
}
|
||||
|
||||
|
||||
HudPos HudCompilerActivityItem::render(
|
||||
HudRenderer& renderer,
|
||||
HudPos position) {
|
||||
if (m_show) {
|
||||
renderer.drawText(16.0f,
|
||||
{ position.x, renderer.surfaceSize().height - 20.0f },
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f },
|
||||
"Compiling shaders...");
|
||||
}
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -354,4 +354,33 @@ namespace dxvk::hud {
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief HUD item to display pipeline compiler activity
|
||||
*/
|
||||
class HudCompilerActivityItem : public HudItem {
|
||||
constexpr static int64_t MinShowDuration = 1500;
|
||||
public:
|
||||
|
||||
HudCompilerActivityItem(const Rc<DxvkDevice>& device);
|
||||
|
||||
~HudCompilerActivityItem();
|
||||
|
||||
void update(dxvk::high_resolution_clock::time_point time);
|
||||
|
||||
HudPos render(
|
||||
HudRenderer& renderer,
|
||||
HudPos position);
|
||||
|
||||
private:
|
||||
|
||||
Rc<DxvkDevice> m_device;
|
||||
|
||||
bool m_show = false;
|
||||
|
||||
dxvk::high_resolution_clock::time_point m_timeShown
|
||||
= dxvk::high_resolution_clock::now();
|
||||
|
||||
};
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user