From 82fbf34f5bd5e0d8cd6f46751e910e56d621d49d Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 23 May 2024 23:41:12 +1000 Subject: [PATCH] ImGuiOverlays: Display vsync queue size in OSD --- pcsx2/ImGui/ImGuiOverlays.cpp | 6 ++++-- pcsx2/MTGS.cpp | 5 +++++ pcsx2/MTGS.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pcsx2/ImGui/ImGuiOverlays.cpp b/pcsx2/ImGui/ImGuiOverlays.cpp index 4931182a0a..ee17844e65 100644 --- a/pcsx2/ImGui/ImGuiOverlays.cpp +++ b/pcsx2/ImGui/ImGuiOverlays.cpp @@ -190,8 +190,10 @@ __ri void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, f if (GSConfig.OsdShowCPU) { text.clear(); - text.append_format("{:.2f}ms | {:.2f}ms | {:.2f}ms", PerformanceMetrics::GetMinimumFrameTime(), - PerformanceMetrics::GetAverageFrameTime(), PerformanceMetrics::GetMaximumFrameTime()); + text.append_format("{} QF | {:.2f}ms | {:.2f}ms | {:.2f}ms", + MTGS::GetCurrentVsyncQueueSize() - 1, // we subtract one for the current frame + PerformanceMetrics::GetMinimumFrameTime(), PerformanceMetrics::GetAverageFrameTime(), + PerformanceMetrics::GetMaximumFrameTime()); DRAW_LINE(fixed_font, text.c_str(), IM_COL32(255, 255, 255, 255)); text.clear(); diff --git a/pcsx2/MTGS.cpp b/pcsx2/MTGS.cpp index b7579b9e86..0adf798824 100644 --- a/pcsx2/MTGS.cpp +++ b/pcsx2/MTGS.cpp @@ -213,6 +213,11 @@ void MTGS::ResetGS(bool hardware_reset) SetEvent(); } +int MTGS::GetCurrentVsyncQueueSize() +{ + return s_QueuedFrameCount.load(std::memory_order_acquire); +} + struct RingCmdPacket_Vsync { u8 regset1[0x0f0]; diff --git a/pcsx2/MTGS.h b/pcsx2/MTGS.h index 0921f8e310..94f22aa03a 100644 --- a/pcsx2/MTGS.h +++ b/pcsx2/MTGS.h @@ -62,6 +62,7 @@ namespace MTGS void WaitForClose(); void Freeze(FreezeAction mode, FreezeData& data); + int GetCurrentVsyncQueueSize(); void PostVsyncStart(bool registers_written); void InitAndReadFIFO(u8* mem, u32 qwc);