From 7dc449ac55830864ecd1c92a5170ff1687336a5d Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 14 Apr 2019 13:28:03 +0200 Subject: [PATCH] [hud] Add new HUD entry to show shader compiler activity --- src/dxvk/hud/dxvk_hud_config.cpp | 1 + src/dxvk/hud/dxvk_hud_config.h | 1 + src/dxvk/hud/dxvk_hud_stats.cpp | 24 +++++++++++++++++++++++- src/dxvk/hud/dxvk_hud_stats.h | 5 +++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/dxvk/hud/dxvk_hud_config.cpp b/src/dxvk/hud/dxvk_hud_config.cpp index 7da4b0704..f9ed06a03 100644 --- a/src/dxvk/hud/dxvk_hud_config.cpp +++ b/src/dxvk/hud/dxvk_hud_config.cpp @@ -14,6 +14,7 @@ namespace dxvk::hud { { "memory", HudElement::StatMemory }, { "version", HudElement::DxvkVersion }, { "api", HudElement::DxvkClientApi }, + { "compiler", HudElement::CompilerActivity }, }}; diff --git a/src/dxvk/hud/dxvk_hud_config.h b/src/dxvk/hud/dxvk_hud_config.h index 4468422f8..bd763a31b 100644 --- a/src/dxvk/hud/dxvk_hud_config.h +++ b/src/dxvk/hud/dxvk_hud_config.h @@ -20,6 +20,7 @@ namespace dxvk::hud { StatMemory = 6, DxvkVersion = 7, DxvkClientApi = 8, + CompilerActivity = 9, }; using HudElements = Flags; diff --git a/src/dxvk/hud/dxvk_hud_stats.cpp b/src/dxvk/hud/dxvk_hud_stats.cpp index cff470ff4..ad94d7965 100644 --- a/src/dxvk/hud/dxvk_hud_stats.cpp +++ b/src/dxvk/hud/dxvk_hud_stats.cpp @@ -39,6 +39,11 @@ namespace dxvk::hud { if (m_elements.test(HudElement::StatMemory)) position = this->printMemoryStats(context, renderer, position); + if (m_elements.test(HudElement::CompilerActivity)) { + this->printCompilerActivity(context, renderer, + { position.x, float(renderer.surfaceSize().height) - 20.0f }); + } + return position; } @@ -142,6 +147,22 @@ namespace dxvk::hud { return { position.x, position.y + 44.0f }; } + + + HudPos HudStats::printCompilerActivity( + const Rc& context, + HudRenderer& renderer, + HudPos position) { + + if (m_prevCounters.getCtr(DxvkStatCounter::PipeCompilerBusy)) { + renderer.drawText(context, 16.0f, + { position.x, position.y }, + { 1.0f, 1.0f, 1.0f, 1.0f }, + "Compiling shaders..."); + } + + return { position.x, position.y + 24.0f }; + } HudElements HudStats::filterElements(HudElements elements) { @@ -149,7 +170,8 @@ namespace dxvk::hud { HudElement::StatDrawCalls, HudElement::StatSubmissions, HudElement::StatPipelines, - HudElement::StatMemory); + HudElement::StatMemory, + HudElement::CompilerActivity); } } diff --git a/src/dxvk/hud/dxvk_hud_stats.h b/src/dxvk/hud/dxvk_hud_stats.h index 493a45c2d..86f8091e7 100644 --- a/src/dxvk/hud/dxvk_hud_stats.h +++ b/src/dxvk/hud/dxvk_hud_stats.h @@ -56,6 +56,11 @@ namespace dxvk::hud { HudRenderer& renderer, HudPos position); + HudPos printCompilerActivity( + const Rc& context, + HudRenderer& renderer, + HudPos position); + static HudElements filterElements(HudElements elements); };