1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-19 05:52:11 +01:00

[hud] Reduce update frequency of queue submission display

Shows the maximum number of submissions encountered per frame
in the given time frame.
This commit is contained in:
Philip Rebohle 2019-12-13 13:01:16 +01:00
parent 3febca6863
commit 2c4879b58c
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 16 additions and 3 deletions

View File

@ -290,8 +290,17 @@ namespace dxvk::hud {
DxvkStatCounters counters = m_device->getStatCounters();
uint32_t currCounter = counters.getCtr(DxvkStatCounter::QueueSubmitCount);
m_diffCounter = currCounter - m_prevCounter;
m_diffCounter = std::max(m_diffCounter, currCounter - m_prevCounter);
m_prevCounter = currCounter;
auto elapsed = std::chrono::duration_cast<std::chrono::microseconds>(time - m_lastUpdate);
if (elapsed.count() >= UpdateInterval) {
m_showCounter = m_diffCounter;
m_diffCounter = 0;
m_lastUpdate = time;
}
}
@ -308,7 +317,7 @@ namespace dxvk::hud {
renderer.drawText(16.0f,
{ position.x + 228.0f, position.y },
{ 1.0f, 1.0f, 1.0f, 1.0f },
str::format(m_diffCounter));
str::format(m_showCounter));
position.y += 8.0f;
return position;

View File

@ -220,7 +220,7 @@ namespace dxvk::hud {
* \brief HUD item to display queue submissions
*/
class HudSubmissionStatsItem : public HudItem {
constexpr static int64_t UpdateInterval = 500'000;
public:
HudSubmissionStatsItem(const Rc<DxvkDevice>& device);
@ -239,6 +239,10 @@ namespace dxvk::hud {
uint64_t m_prevCounter = 0;
uint64_t m_diffCounter = 0;
uint64_t m_showCounter = 0;
dxvk::high_resolution_clock::time_point m_lastUpdate
= dxvk::high_resolution_clock::now();
};