mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +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) {
|
void HudSubmissionStatsItem::update(dxvk::high_resolution_clock::time_point time) {
|
||||||
DxvkStatCounters counters = m_device->getStatCounters();
|
DxvkStatCounters counters = m_device->getStatCounters();
|
||||||
|
|
||||||
uint32_t currCounter = counters.getCtr(DxvkStatCounter::QueueSubmitCount);
|
uint64_t currSubmitCount = counters.getCtr(DxvkStatCounter::QueueSubmitCount);
|
||||||
m_diffCounter = std::max(m_diffCounter, currCounter - m_prevCounter);
|
uint64_t currSyncCount = counters.getCtr(DxvkStatCounter::GpuSyncCount);
|
||||||
m_prevCounter = currCounter;
|
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);
|
auto elapsed = std::chrono::duration_cast<std::chrono::microseconds>(time - m_lastUpdate);
|
||||||
|
|
||||||
if (elapsed.count() >= UpdateInterval) {
|
if (elapsed.count() >= UpdateInterval) {
|
||||||
m_showCounter = m_diffCounter;
|
m_submitString = str::format(m_maxSubmitCount);
|
||||||
m_diffCounter = 0;
|
|
||||||
|
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;
|
m_lastUpdate = time;
|
||||||
}
|
}
|
||||||
@ -333,12 +350,23 @@ namespace dxvk::hud {
|
|||||||
renderer.drawText(16.0f,
|
renderer.drawText(16.0f,
|
||||||
{ position.x, position.y },
|
{ position.x, position.y },
|
||||||
{ 1.0f, 0.5f, 0.25f, 1.0f },
|
{ 1.0f, 0.5f, 0.25f, 1.0f },
|
||||||
"Queue submissions: ");
|
"Queue submissions:");
|
||||||
|
|
||||||
renderer.drawText(16.0f,
|
renderer.drawText(16.0f,
|
||||||
{ position.x + 228.0f, position.y },
|
{ position.x + 228.0f, position.y },
|
||||||
{ 1.0f, 1.0f, 1.0f, 1.0f },
|
{ 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;
|
position.y += 8.0f;
|
||||||
return position;
|
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 {
|
class HudSubmissionStatsItem : public HudItem {
|
||||||
constexpr static int64_t UpdateInterval = 500'000;
|
constexpr static int64_t UpdateInterval = 500'000;
|
||||||
@ -258,9 +258,16 @@ namespace dxvk::hud {
|
|||||||
|
|
||||||
Rc<DxvkDevice> m_device;
|
Rc<DxvkDevice> m_device;
|
||||||
|
|
||||||
uint64_t m_prevCounter = 0;
|
uint64_t m_prevSubmitCount = 0;
|
||||||
uint64_t m_diffCounter = 0;
|
uint64_t m_prevSyncCount = 0;
|
||||||
uint64_t m_showCounter = 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::time_point m_lastUpdate
|
||||||
= dxvk::high_resolution_clock::now();
|
= dxvk::high_resolution_clock::now();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user