diff --git a/src/dxvk/hud/dxvk_hud.cpp b/src/dxvk/hud/dxvk_hud.cpp index 40866d15..5ceb0678 100644 --- a/src/dxvk/hud/dxvk_hud.cpp +++ b/src/dxvk/hud/dxvk_hud.cpp @@ -44,6 +44,7 @@ namespace dxvk::hud { addItem("pipelines", device); addItem("memory", device); addItem("gpuload", device); + addItem("compiler", device); } diff --git a/src/dxvk/hud/dxvk_hud_item.cpp b/src/dxvk/hud/dxvk_hud_item.cpp index 773cae5a..513cc8ea 100644 --- a/src/dxvk/hud/dxvk_hud_item.cpp +++ b/src/dxvk/hud/dxvk_hud_item.cpp @@ -477,4 +477,45 @@ namespace dxvk::hud { return position; } + + HudCompilerActivityItem::HudCompilerActivityItem(const Rc& 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(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; + } + } diff --git a/src/dxvk/hud/dxvk_hud_item.h b/src/dxvk/hud/dxvk_hud_item.h index b66ff068..3398f6f9 100644 --- a/src/dxvk/hud/dxvk_hud_item.h +++ b/src/dxvk/hud/dxvk_hud_item.h @@ -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& device); + + ~HudCompilerActivityItem(); + + void update(dxvk::high_resolution_clock::time_point time); + + HudPos render( + HudRenderer& renderer, + HudPos position); + + private: + + Rc m_device; + + bool m_show = false; + + dxvk::high_resolution_clock::time_point m_timeShown + = dxvk::high_resolution_clock::now(); + + }; + } \ No newline at end of file