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.
This commit is contained in:
parent
b3aa6ad93b
commit
fdd1934f12
|
@ -13,6 +13,7 @@
|
||||||
#include "Present.h"
|
#include "Present.h"
|
||||||
#include "VideoCommon/AbstractGfx.h"
|
#include "VideoCommon/AbstractGfx.h"
|
||||||
#include "VideoCommon/FrameDumper.h"
|
#include "VideoCommon/FrameDumper.h"
|
||||||
|
#include "VideoCommon/FramebufferManager.h"
|
||||||
#include "VideoCommon/OnScreenUI.h"
|
#include "VideoCommon/OnScreenUI.h"
|
||||||
#include "VideoCommon/PostProcessing.h"
|
#include "VideoCommon/PostProcessing.h"
|
||||||
#include "VideoCommon/Statistics.h"
|
#include "VideoCommon/Statistics.h"
|
||||||
|
@ -202,20 +203,46 @@ void Presenter::ProcessFrameDumping(u64 ticks) const
|
||||||
|
|
||||||
void Presenter::SetBackbuffer(int backbuffer_width, int backbuffer_height)
|
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_width = backbuffer_width;
|
||||||
m_backbuffer_height = backbuffer_height;
|
m_backbuffer_height = backbuffer_height;
|
||||||
UpdateDrawRectangle();
|
UpdateDrawRectangle();
|
||||||
|
|
||||||
|
OnBackbufferSet(size_changed, is_first);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Presenter::SetBackbuffer(SurfaceInfo info)
|
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_width = info.width;
|
||||||
m_backbuffer_height = info.height;
|
m_backbuffer_height = info.height;
|
||||||
m_backbuffer_scale = info.scale;
|
m_backbuffer_scale = info.scale;
|
||||||
m_backbuffer_format = info.format;
|
m_backbuffer_format = info.format;
|
||||||
if (m_onscreen_ui)
|
if (m_onscreen_ui)
|
||||||
m_onscreen_ui->SetScale(info.scale);
|
m_onscreen_ui->SetScale(info.scale);
|
||||||
|
|
||||||
|
OnBackbufferSet(size_changed, is_first);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Presenter::OnBackbufferSet(bool size_changed, bool is_first_set)
|
||||||
|
{
|
||||||
UpdateDrawRectangle();
|
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)
|
void Presenter::ConfigChanged(u32 changed_bits)
|
||||||
|
|
|
@ -55,6 +55,7 @@ public:
|
||||||
void SetSuggestedWindowSize(int width, int height);
|
void SetSuggestedWindowSize(int width, int height);
|
||||||
void SetBackbuffer(int backbuffer_width, int backbuffer_height);
|
void SetBackbuffer(int backbuffer_width, int backbuffer_height);
|
||||||
void SetBackbuffer(SurfaceInfo info);
|
void SetBackbuffer(SurfaceInfo info);
|
||||||
|
void OnBackbufferSet(bool size_changed, bool is_first_set);
|
||||||
|
|
||||||
void UpdateDrawRectangle();
|
void UpdateDrawRectangle();
|
||||||
|
|
||||||
|
@ -104,6 +105,8 @@ private:
|
||||||
|
|
||||||
void ProcessFrameDumping(u64 ticks) const;
|
void ProcessFrameDumping(u64 ticks) const;
|
||||||
|
|
||||||
|
void OnBackBufferSizeChanged();
|
||||||
|
|
||||||
std::tuple<int, int> CalculateOutputDimensions(int width, int height,
|
std::tuple<int, int> CalculateOutputDimensions(int width, int height,
|
||||||
bool allow_stretch = true) const;
|
bool allow_stretch = true) const;
|
||||||
std::tuple<float, float> ApplyStandardAspectCrop(float width, float height,
|
std::tuple<float, float> ApplyStandardAspectCrop(float width, float height,
|
||||||
|
@ -132,6 +135,8 @@ private:
|
||||||
// Offsets imply black borders (if the window aspect ratio doesn't match the game's one).
|
// Offsets imply black borders (if the window aspect ratio doesn't match the game's one).
|
||||||
MathUtil::Rectangle<int> m_target_rectangle = {};
|
MathUtil::Rectangle<int> m_target_rectangle = {};
|
||||||
|
|
||||||
|
u32 m_auto_resolution_scale = 1;
|
||||||
|
|
||||||
RcTcacheEntry m_xfb_entry;
|
RcTcacheEntry m_xfb_entry;
|
||||||
MathUtil::Rectangle<int> m_xfb_rect;
|
MathUtil::Rectangle<int> m_xfb_rect;
|
||||||
|
|
||||||
|
|
|
@ -289,6 +289,7 @@ void CheckForConfigChanges()
|
||||||
const u32 old_game_mod_changes =
|
const u32 old_game_mod_changes =
|
||||||
g_ActiveConfig.graphics_mod_config ? g_ActiveConfig.graphics_mod_config->GetChangeCount() : 0;
|
g_ActiveConfig.graphics_mod_config ? g_ActiveConfig.graphics_mod_config->GetChangeCount() : 0;
|
||||||
const bool old_graphics_mods_enabled = g_ActiveConfig.bGraphicMods;
|
const bool old_graphics_mods_enabled = g_ActiveConfig.bGraphicMods;
|
||||||
|
const AspectMode old_aspect_mode = g_ActiveConfig.aspect_mode;
|
||||||
const AspectMode old_suggested_aspect_mode = g_ActiveConfig.suggested_aspect_mode;
|
const AspectMode old_suggested_aspect_mode = g_ActiveConfig.suggested_aspect_mode;
|
||||||
const bool old_widescreen_hack = g_ActiveConfig.bWidescreenHack;
|
const bool old_widescreen_hack = g_ActiveConfig.bWidescreenHack;
|
||||||
const auto old_post_processing_shader = g_ActiveConfig.sPostProcessingShader;
|
const auto old_post_processing_shader = g_ActiveConfig.sPostProcessingShader;
|
||||||
|
@ -338,6 +339,8 @@ void CheckForConfigChanges()
|
||||||
changed_bits |= CONFIG_CHANGE_BIT_BBOX;
|
changed_bits |= CONFIG_CHANGE_BIT_BBOX;
|
||||||
if (old_efb_scale != g_ActiveConfig.iEFBScale)
|
if (old_efb_scale != g_ActiveConfig.iEFBScale)
|
||||||
changed_bits |= CONFIG_CHANGE_BIT_TARGET_SIZE;
|
changed_bits |= CONFIG_CHANGE_BIT_TARGET_SIZE;
|
||||||
|
if (old_aspect_mode != g_ActiveConfig.aspect_mode)
|
||||||
|
changed_bits |= CONFIG_CHANGE_BIT_ASPECT_RATIO;
|
||||||
if (old_suggested_aspect_mode != g_ActiveConfig.suggested_aspect_mode)
|
if (old_suggested_aspect_mode != g_ActiveConfig.suggested_aspect_mode)
|
||||||
changed_bits |= CONFIG_CHANGE_BIT_ASPECT_RATIO;
|
changed_bits |= CONFIG_CHANGE_BIT_ASPECT_RATIO;
|
||||||
if (old_widescreen_hack != g_ActiveConfig.bWidescreenHack)
|
if (old_widescreen_hack != g_ActiveConfig.bWidescreenHack)
|
||||||
|
|
Loading…
Reference in New Issue