From c958dbc46cd93b24aa9c63332739b4040880c711 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 19 Jun 2026 12:27:38 +0200 Subject: VideoCommon: Use XFB for internal resolution stats fb4ff3e added a statistics option to show the internal resolution, but it just showed the total size of the EFB (which is always 640x528) times the IR scale, so it didn't convey any useful information. This commit instead makes the option use the size of the last XFB copy (not multiplied by the IR scale), which changes based on the game's rendering resolution. --- Source/Core/VideoCommon/PerformanceMetrics.cpp | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'Source/Core/VideoCommon/PerformanceMetrics.cpp') diff --git a/Source/Core/VideoCommon/PerformanceMetrics.cpp b/Source/Core/VideoCommon/PerformanceMetrics.cpp index fccc8ae38e..b94fc6fade 100644 --- a/Source/Core/VideoCommon/PerformanceMetrics.cpp +++ b/Source/Core/VideoCommon/PerformanceMetrics.cpp @@ -11,7 +11,6 @@ #include "Common/HookableEvent.h" #include "Core/Config/GraphicsSettings.h" #include "Core/Core.h" -#include "VideoCommon/FramebufferManager.h" #include "VideoCommon/VideoConfig.h" PerformanceMetrics::PerformanceMetrics() @@ -89,20 +88,6 @@ double PerformanceMetrics::GetFPS() const return m_fps_counter.GetHzAvg(); } -u32 PerformanceMetrics::GetEFBWidth() const -{ - if (g_framebuffer_manager) - return g_framebuffer_manager->GetEFBWidth(); - return 0; -} - -u32 PerformanceMetrics::GetEFBHeight() const -{ - if (g_framebuffer_manager) - return g_framebuffer_manager->GetEFBHeight(); - return 0; -} - double PerformanceMetrics::GetVPS() const { return m_vps_counter.GetHzAvg(); @@ -123,6 +108,11 @@ void PerformanceMetrics::SetLatestFramePresentationOffset(DT offset) m_frame_presentation_offset.store(offset, std::memory_order_relaxed); } +void PerformanceMetrics::SetLatestFrameBufferSize(u32 width, u32 height) +{ + m_frame_buffer_size.store(FrameBufferSize{width, height}, std::memory_order_relaxed); +} + void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale) { m_vps_counter.UpdateStats(); @@ -139,8 +129,6 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale) const double fps = GetFPS(); const double vps = GetVPS(); const double speed = GetSpeed(); - const u32 width = GetEFBWidth(); - const u32 height = GetEFBHeight(); static ImVec2 last_display_size(-1.0f, -1.0f); @@ -350,7 +338,8 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale) clamp_window_position(); - ImGui::TextColored(ImVec4(r, g, b, 1.0f), "Res: %ux%u", width, height); + const FrameBufferSize size = m_frame_buffer_size.load(std::memory_order_relaxed); + ImGui::TextColored(ImVec4(r, g, b, 1.0f), "XFB res: %ux%u", size.width, size.height); } ImGui::End(); } -- cgit v1.2.3 From 6f72de3579c9420e8255649c76ad234555cd50c9 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Fri, 19 Jun 2026 12:31:46 +0200 Subject: VideoCommon: Show internal resolution stats below VPS It looked a bit out of place wedged in between the FPS and VPS. --- Source/Core/VideoCommon/PerformanceMetrics.cpp | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'Source/Core/VideoCommon/PerformanceMetrics.cpp') diff --git a/Source/Core/VideoCommon/PerformanceMetrics.cpp b/Source/Core/VideoCommon/PerformanceMetrics.cpp index b94fc6fade..98efa64108 100644 --- a/Source/Core/VideoCommon/PerformanceMetrics.cpp +++ b/Source/Core/VideoCommon/PerformanceMetrics.cpp @@ -323,50 +323,50 @@ void PerformanceMetrics::DrawImGuiStats(const float backbuffer_scale) ImGui::End(); } - if (g_ActiveConfig.bShowInternalResolution) + if (g_ActiveConfig.bShowVPS || g_ActiveConfig.bShowVTimes) { + // Position in the top-right corner of the screen. ImGui::SetNextWindowPos(ImVec2(window_x, window_y), set_next_position_condition, ImVec2(1.0f, 0.0f)); ImGui::SetNextWindowBgAlpha(bg_alpha); - if (ImGui::Begin("ResolutionStats", nullptr, imgui_flags)) + if (ImGui::Begin("VPSStats", nullptr, imgui_flags)) { if (stack_vertically) window_y += ImGui::GetWindowHeight() + window_padding; else window_x -= ImGui::GetWindowWidth() + window_padding; - clamp_window_position(); - - const FrameBufferSize size = m_frame_buffer_size.load(std::memory_order_relaxed); - ImGui::TextColored(ImVec4(r, g, b, 1.0f), "XFB res: %ux%u", size.width, size.height); + if (g_ActiveConfig.bShowVPS) + ImGui::TextColored(ImVec4(r, g, b, 1.0f), "VPS:%7.2lf", vps); + if (g_ActiveConfig.bShowVTimes) + { + ImGui::TextColored(ImVec4(r, g, b, 1.0f), "dt:%6.2lfms", + DT_ms(m_vps_counter.GetDtAvg()).count()); + ImGui::TextColored(ImVec4(r, g, b, 1.0f), " ±:%6.2lfms", + DT_ms(m_vps_counter.GetDtStd()).count()); + } } ImGui::End(); } - if (g_ActiveConfig.bShowVPS || g_ActiveConfig.bShowVTimes) + if (g_ActiveConfig.bShowInternalResolution) { - // Position in the top-right corner of the screen. ImGui::SetNextWindowPos(ImVec2(window_x, window_y), set_next_position_condition, ImVec2(1.0f, 0.0f)); ImGui::SetNextWindowBgAlpha(bg_alpha); - if (ImGui::Begin("VPSStats", nullptr, imgui_flags)) + if (ImGui::Begin("ResolutionStats", nullptr, imgui_flags)) { if (stack_vertically) window_y += ImGui::GetWindowHeight() + window_padding; else window_x -= ImGui::GetWindowWidth() + window_padding; + clamp_window_position(); - if (g_ActiveConfig.bShowVPS) - ImGui::TextColored(ImVec4(r, g, b, 1.0f), "VPS:%7.2lf", vps); - if (g_ActiveConfig.bShowVTimes) - { - ImGui::TextColored(ImVec4(r, g, b, 1.0f), "dt:%6.2lfms", - DT_ms(m_vps_counter.GetDtAvg()).count()); - ImGui::TextColored(ImVec4(r, g, b, 1.0f), " ±:%6.2lfms", - DT_ms(m_vps_counter.GetDtStd()).count()); - } + + const FrameBufferSize size = m_frame_buffer_size.load(std::memory_order_relaxed); + ImGui::TextColored(ImVec4(r, g, b, 1.0f), "XFB res: %ux%u", size.width, size.height); } ImGui::End(); } -- cgit v1.2.3