From 044e3967e7a74c8843d4142a64b5194f9320a4ea Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 15 Apr 2019 12:42:07 +0200 Subject: [PATCH] [hud] Show compiler activity indicator for at least one second Otherwise this would flicker when shaders are already cached. --- src/dxvk/hud/dxvk_hud_stats.cpp | 16 ++++++++++++++-- src/dxvk/hud/dxvk_hud_stats.h | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/dxvk/hud/dxvk_hud_stats.cpp b/src/dxvk/hud/dxvk_hud_stats.cpp index ad94d7965..7160f7009 100644 --- a/src/dxvk/hud/dxvk_hud_stats.cpp +++ b/src/dxvk/hud/dxvk_hud_stats.cpp @@ -3,7 +3,8 @@ namespace dxvk::hud { HudStats::HudStats(HudElements elements) - : m_elements(filterElements(elements)) { } + : m_elements(filterElements(elements)), + m_compilerShowTime(std::chrono::high_resolution_clock::now()) { } HudStats::~HudStats() { @@ -153,8 +154,19 @@ namespace dxvk::hud { const Rc& context, HudRenderer& renderer, HudPos position) { + auto now = std::chrono::high_resolution_clock::now(); + bool doShow = m_prevCounters.getCtr(DxvkStatCounter::PipeCompilerBusy); + + if (m_prevCounters.getCtr(DxvkStatCounter::PipeCompilerBusy) + && m_diffCounters.getCtr(DxvkStatCounter::PipeCompilerBusy)) + m_compilerShowTime = now; - if (m_prevCounters.getCtr(DxvkStatCounter::PipeCompilerBusy)) { + if (!doShow) { + doShow |= std::chrono::duration_cast(now - m_compilerShowTime) + < std::chrono::milliseconds(1000); + } + + if (doShow) { renderer.drawText(context, 16.0f, { position.x, position.y }, { 1.0f, 1.0f, 1.0f, 1.0f }, diff --git a/src/dxvk/hud/dxvk_hud_stats.h b/src/dxvk/hud/dxvk_hud_stats.h index 86f8091e7..89009af5a 100644 --- a/src/dxvk/hud/dxvk_hud_stats.h +++ b/src/dxvk/hud/dxvk_hud_stats.h @@ -1,5 +1,7 @@ #pragma once +#include + #include "../dxvk_stats.h" #include "dxvk_hud_config.h" @@ -35,6 +37,8 @@ namespace dxvk::hud { DxvkStatCounters m_prevCounters; DxvkStatCounters m_diffCounters; + + std::chrono::high_resolution_clock::time_point m_compilerShowTime; HudPos printDrawCallStats( const Rc& context,