mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-05 01:24:14 +01:00
[hud] Display GPU synchronization in HUD
This commit is contained in:
parent
4d9b464f7c
commit
63bf928ab5
@ -310,15 +310,32 @@ namespace dxvk::hud {
|
||||
void HudSubmissionStatsItem::update(dxvk::high_resolution_clock::time_point time) {
|
||||
DxvkStatCounters counters = m_device->getStatCounters();
|
||||
|
||||
uint32_t currCounter = counters.getCtr(DxvkStatCounter::QueueSubmitCount);
|
||||
m_diffCounter = std::max(m_diffCounter, currCounter - m_prevCounter);
|
||||
m_prevCounter = currCounter;
|
||||
uint64_t currSubmitCount = counters.getCtr(DxvkStatCounter::QueueSubmitCount);
|
||||
uint64_t currSyncCount = counters.getCtr(DxvkStatCounter::GpuSyncCount);
|
||||
uint64_t currSyncTicks = counters.getCtr(DxvkStatCounter::GpuSyncTicks);
|
||||
|
||||
m_maxSubmitCount = std::max(m_maxSubmitCount, currSubmitCount - m_prevSubmitCount);
|
||||
m_maxSyncCount = std::max(m_maxSyncCount, currSyncCount - m_prevSyncCount);
|
||||
m_maxSyncTicks = std::max(m_maxSyncTicks, currSyncTicks - m_prevSyncTicks);
|
||||
|
||||
m_prevSubmitCount = currSubmitCount;
|
||||
m_prevSyncCount = currSyncCount;
|
||||
m_prevSyncTicks = currSyncTicks;
|
||||
|
||||
auto elapsed = std::chrono::duration_cast<std::chrono::microseconds>(time - m_lastUpdate);
|
||||
|
||||
if (elapsed.count() >= UpdateInterval) {
|
||||
m_showCounter = m_diffCounter;
|
||||
m_diffCounter = 0;
|
||||
m_submitString = str::format(m_maxSubmitCount);
|
||||
|
||||
uint64_t syncTicks = m_maxSyncTicks / 100;
|
||||
|
||||
m_syncString = m_maxSyncCount
|
||||
? str::format(m_maxSyncCount, " (", (syncTicks / 10), ".", (syncTicks % 10), " ms)")
|
||||
: str::format(m_maxSyncCount);
|
||||
|
||||
m_maxSubmitCount = 0;
|
||||
m_maxSyncCount = 0;
|
||||
m_maxSyncTicks = 0;
|
||||
|
||||
m_lastUpdate = time;
|
||||
}
|
||||
@ -333,12 +350,23 @@ namespace dxvk::hud {
|
||||
renderer.drawText(16.0f,
|
||||
{ position.x, position.y },
|
||||
{ 1.0f, 0.5f, 0.25f, 1.0f },
|
||||
"Queue submissions: ");
|
||||
"Queue submissions:");
|
||||
|
||||
renderer.drawText(16.0f,
|
||||
{ position.x + 228.0f, position.y },
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f },
|
||||
str::format(m_showCounter));
|
||||
m_submitString);
|
||||
|
||||
position.y += 20.0f;
|
||||
renderer.drawText(16.0f,
|
||||
{ position.x, position.y },
|
||||
{ 1.0f, 0.5f, 0.25f, 1.0f },
|
||||
"Queue syncs:");
|
||||
|
||||
renderer.drawText(16.0f,
|
||||
{ position.x + 228.0f, position.y },
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f },
|
||||
m_syncString);
|
||||
|
||||
position.y += 8.0f;
|
||||
return position;
|
||||
|
@ -238,7 +238,7 @@ namespace dxvk::hud {
|
||||
|
||||
|
||||
/**
|
||||
* \brief HUD item to display queue submissions
|
||||
* \brief HUD item to display queue statistics
|
||||
*/
|
||||
class HudSubmissionStatsItem : public HudItem {
|
||||
constexpr static int64_t UpdateInterval = 500'000;
|
||||
@ -258,9 +258,16 @@ namespace dxvk::hud {
|
||||
|
||||
Rc<DxvkDevice> m_device;
|
||||
|
||||
uint64_t m_prevCounter = 0;
|
||||
uint64_t m_diffCounter = 0;
|
||||
uint64_t m_showCounter = 0;
|
||||
uint64_t m_prevSubmitCount = 0;
|
||||
uint64_t m_prevSyncCount = 0;
|
||||
uint64_t m_prevSyncTicks = 0;
|
||||
|
||||
uint64_t m_maxSubmitCount = 0;
|
||||
uint64_t m_maxSyncCount = 0;
|
||||
uint64_t m_maxSyncTicks = 0;
|
||||
|
||||
std::string m_submitString;
|
||||
std::string m_syncString;
|
||||
|
||||
dxvk::high_resolution_clock::time_point m_lastUpdate
|
||||
= dxvk::high_resolution_clock::now();
|
||||
|
Loading…
Reference in New Issue
Block a user