summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Present.cpp
diff options
context:
space:
mode:
authorFiloppi <filippotarpini@hotmail.it>2023-09-07 02:36:31 +0300
committerFiloppi <filippotarpini@hotmail.it>2023-12-18 02:00:25 +0200
commitfdd1934f12f684833e158f1859341f887ab4d447 (patch)
treed5d6a61f0b37c5414bd53fb07e824bcc92b4d528 /Source/Core/VideoCommon/Present.cpp
parentb3aa6ad93b16e026601f2138396db256eadf9fc9 (diff)
Video: fix Auto Resolution Scale not updating when the window was resized.
Also fixes the widescreen hack not fully updating when the aspect ratio setting changed on the spot.
Diffstat (limited to 'Source/Core/VideoCommon/Present.cpp')
-rw-r--r--Source/Core/VideoCommon/Present.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/Present.cpp b/Source/Core/VideoCommon/Present.cpp
index e51d52107c..4f208f5119 100644
--- a/Source/Core/VideoCommon/Present.cpp
+++ b/Source/Core/VideoCommon/Present.cpp
@@ -13,6 +13,7 @@
#include "Present.h"
#include "VideoCommon/AbstractGfx.h"
#include "VideoCommon/FrameDumper.h"
+#include "VideoCommon/FramebufferManager.h"
#include "VideoCommon/OnScreenUI.h"
#include "VideoCommon/PostProcessing.h"
#include "VideoCommon/Statistics.h"
@@ -202,20 +203,46 @@ void Presenter::ProcessFrameDumping(u64 ticks) const
void Presenter::SetBackbuffer(int backbuffer_width, int backbuffer_height)
{
+ const bool is_first = m_backbuffer_width == 0 && m_backbuffer_height == 0;
+ const bool size_changed =
+ (m_backbuffer_width != backbuffer_width || m_backbuffer_height != backbuffer_height);
m_backbuffer_width = backbuffer_width;
m_backbuffer_height = backbuffer_height;
UpdateDrawRectangle();
+
+ OnBackbufferSet(size_changed, is_first);
}
void Presenter::SetBackbuffer(SurfaceInfo info)
{
+ const bool is_first = m_backbuffer_width == 0 && m_backbuffer_height == 0;
+ const bool size_changed =
+ (m_backbuffer_width != (int)info.width || m_backbuffer_height != (int)info.height);
m_backbuffer_width = info.width;
m_backbuffer_height = info.height;
m_backbuffer_scale = info.scale;
m_backbuffer_format = info.format;
if (m_onscreen_ui)
m_onscreen_ui->SetScale(info.scale);
+
+ OnBackbufferSet(size_changed, is_first);
+}
+
+void Presenter::OnBackbufferSet(bool size_changed, bool is_first_set)
+{
UpdateDrawRectangle();
+
+ // Automatically update the resolution scale if the window size changed,
+ // or if the game XFB resolution changed.
+ if (size_changed && !is_first_set && g_ActiveConfig.iEFBScale == EFB_SCALE_AUTO_INTEGRAL &&
+ m_auto_resolution_scale != AutoIntegralScale())
+ {
+ g_framebuffer_manager->RecreateEFBFramebuffer();
+ }
+ if (size_changed || is_first_set)
+ {
+ m_auto_resolution_scale = AutoIntegralScale();
+ }
}
void Presenter::ConfigChanged(u32 changed_bits)