From d6230bbad83d1961e31c88cc2da4f2a6eb1edc35 Mon Sep 17 00:00:00 2001 From: Filoppi Date: Mon, 18 Dec 2023 00:52:31 +0200 Subject: [PATCH] Video: Change the frame dumper to actually use the raw emulation output resolution, avoiding any scaling if possible. This should make comparisons much more reliable as pixels wouldn't be smushed together or stretched. --- .../Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp | 5 ++--- Source/Core/VideoCommon/Present.cpp | 11 +++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp index 9f86ea5ed1..34b6fde739 100644 --- a/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp @@ -339,9 +339,8 @@ void AdvancedWidget::AddDescriptions() QT_TR_NOOP("Loads graphics mods from User/Load/GraphicsMods/.

If " "unsure, leave this unchecked."); static const char TR_INTERNAL_RESOLUTION_FRAME_DUMPING_DESCRIPTION[] = QT_TR_NOOP( - "Creates frame dumps and screenshots at the internal resolution of the renderer, rather than " - "the size of the window it is displayed within.

If the aspect ratio is widescreen, " - "the output image will be scaled horizontally to preserve the vertical resolution.

" + "Creates frame dumps and screenshots at the raw internal resolution of the renderer," + "rather than using the size it is displayed within the window.

" "If unsure, leave this unchecked."); #if defined(HAVE_FFMPEG) static const char TR_USE_FFV1_DESCRIPTION[] = diff --git a/Source/Core/VideoCommon/Present.cpp b/Source/Core/VideoCommon/Present.cpp index 0cc19d6e14..322685084d 100644 --- a/Source/Core/VideoCommon/Present.cpp +++ b/Source/Core/VideoCommon/Present.cpp @@ -214,14 +214,17 @@ void Presenter::ProcessFrameDumping(u64 ticks) const MathUtil::Rectangle target_rect; if (!g_ActiveConfig.bInternalResolutionFrameDumps && !g_gfx->IsHeadless()) { + // This is already scaled by "VIDEO_ENCODER_LCM" target_rect = GetTargetRectangle(); } else { - int width, height; - std::tie(width, height) = - CalculateOutputDimensions(m_xfb_rect.GetWidth(), m_xfb_rect.GetHeight()); - target_rect = MathUtil::Rectangle(0, 0, width, height); + target_rect = m_xfb_rect; + ASSERT(target_rect.top == 0 && target_rect.left == 0); + // Scale positively to make sure the least amount of information is lost. + // TODO: this should be added as black padding on the edges by the frame dumper + target_rect.right += VIDEO_ENCODER_LCM - (target_rect.GetWidth() % VIDEO_ENCODER_LCM); + target_rect.bottom += VIDEO_ENCODER_LCM - (target_rect.GetHeight() % VIDEO_ENCODER_LCM); } g_frame_dumper->DumpCurrentFrame(m_xfb_entry->texture.get(), m_xfb_rect, target_rect, ticks,