Skip to content

Commit bf92b2c

Browse files
committed
Tune iOS rendering defaults
1 parent ecf0763 commit bf92b2c

1 file changed

Lines changed: 36 additions & 9 deletions

File tree

UnleashedRecomp/gpu/video.cpp

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,9 +1649,9 @@ static void ApplyLowEndDefault(ConfigDef<T> &configDef, T newDefault, bool &chan
16491649

16501650
#ifdef UNLEASHED_RECOMP_IOS
16511651
template<typename T, bool isHidden>
1652-
static void ApplyIOSDefault(ConfigDef<T, isHidden>& configDef, T desktopDefault, T iosDefault, bool& changed)
1652+
static void ApplyIOSDefault(ConfigDef<T, isHidden>& configDef, T desktopDefault, T previousIOSDefault, T iosDefault, bool& changed)
16531653
{
1654-
const bool shouldApply = !configDef.IsLoadedFromConfig || configDef.Value == desktopDefault;
1654+
const bool shouldApply = !configDef.IsLoadedFromConfig || configDef.Value == desktopDefault || configDef.Value == previousIOSDefault;
16551655

16561656
if (shouldApply && configDef.Value != iosDefault)
16571657
{
@@ -1662,24 +1662,50 @@ static void ApplyIOSDefault(ConfigDef<T, isHidden>& configDef, T desktopDefault,
16621662
configDef.DefaultValue = iosDefault;
16631663
}
16641664

1665+
template<typename T, bool isHidden>
1666+
static void ApplyIOSDefault(ConfigDef<T, isHidden>& configDef, T desktopDefault, T iosDefault, bool& changed)
1667+
{
1668+
ApplyIOSDefault(configDef, desktopDefault, iosDefault, iosDefault, changed);
1669+
}
1670+
16651671
static void ApplyIOSPerformanceDefaults()
16661672
{
16671673
bool changed = false;
16681674

1669-
ApplyIOSDefault(Config::ResolutionScale, 1.0f, 0.65f, changed);
1675+
ApplyIOSDefault(Config::ResolutionScale, 1.0f, 0.65f, 0.55f, changed);
16701676
ApplyIOSDefault(Config::AntiAliasing, EAntiAliasing::MSAA4x, EAntiAliasing::None, changed);
16711677
ApplyIOSDefault(Config::TransparencyAntiAliasing, true, false, changed);
1672-
ApplyIOSDefault(Config::AnisotropicFiltering, 16u, 4u, changed);
1678+
ApplyIOSDefault(Config::AnisotropicFiltering, 16u, 4u, 2u, changed);
16731679
ApplyIOSDefault(Config::ShadowResolution, EShadowResolution::x4096, EShadowResolution::Original, changed);
16741680
ApplyIOSDefault(Config::GITextureFiltering, EGITextureFiltering::Bicubic, EGITextureFiltering::Bilinear, changed);
16751681
ApplyIOSDefault(Config::DepthOfFieldQuality, EDepthOfFieldQuality::Auto, EDepthOfFieldQuality::Low, changed);
1676-
ApplyIOSDefault(Config::MaxFrameLatency, 2u, 1u, changed);
1682+
ApplyIOSDefault(Config::MotionBlur, EMotionBlur::Original, EMotionBlur::Off, changed);
1683+
ApplyIOSDefault(Config::TripleBuffering, ETripleBuffering::Auto, ETripleBuffering::On, changed);
1684+
ApplyIOSDefault(Config::MaxFrameLatency, 2u, 1u, 2u, changed);
16771685

16781686
if (changed)
16791687
Config::Save();
16801688
}
16811689
#endif
16821690

1691+
static float GetEffectiveResolutionScale()
1692+
{
1693+
float resolutionScale = Config::ResolutionScale.Value;
1694+
1695+
#ifdef UNLEASHED_RECOMP_IOS
1696+
if (Config::ResolutionScale.Value <= Config::ResolutionScale.DefaultValue + 0.001f && Video::s_viewportHeight != 0)
1697+
{
1698+
constexpr float maxDefaultRenderHeight = 720.0f;
1699+
const float cappedScale = maxDefaultRenderHeight / float(Video::s_viewportHeight);
1700+
1701+
if (resolutionScale > cappedScale)
1702+
resolutionScale = cappedScale;
1703+
}
1704+
#endif
1705+
1706+
return resolutionScale;
1707+
}
1708+
16831709
static void ApplyLowEndDefaults()
16841710
{
16851711
bool changed = false;
@@ -5237,7 +5263,7 @@ static void ProcSetPixelShader(const RenderCommand& cmd)
52375263
{
52385264
if (g_aspectRatio >= WIDE_ASPECT_RATIO)
52395265
{
5240-
size_t height = round(Video::s_viewportHeight * Config::ResolutionScale);
5266+
size_t height = round(Video::s_viewportHeight * GetEffectiveResolutionScale());
52415267

52425268
if (height > 1440)
52435269
shaderIndex = GAUSSIAN_BLUR_9X9;
@@ -5251,7 +5277,7 @@ static void ProcSetPixelShader(const RenderCommand& cmd)
52515277
else
52525278
{
52535279
// Narrow aspect ratios should check for width to account for VERT+.
5254-
size_t width = round(Video::s_viewportWidth * Config::ResolutionScale);
5280+
size_t width = round(Video::s_viewportWidth * GetEffectiveResolutionScale());
52555281

52565282
if (width > 2560)
52575283
shaderIndex = GAUSSIAN_BLUR_9X9;
@@ -5929,8 +5955,9 @@ static void SetResolution(be<uint32_t>* device)
59295955
{
59305956
Video::ComputeViewportDimensions();
59315957

5932-
uint32_t width = uint32_t(round(Video::s_viewportWidth * Config::ResolutionScale));
5933-
uint32_t height = uint32_t(round(Video::s_viewportHeight * Config::ResolutionScale));
5958+
const float resolutionScale = GetEffectiveResolutionScale();
5959+
uint32_t width = uint32_t(round(Video::s_viewportWidth * resolutionScale));
5960+
uint32_t height = uint32_t(round(Video::s_viewportHeight * resolutionScale));
59345961
device[46] = width == 0 ? 880 : width;
59355962
device[47] = height == 0 ? 720 : height;
59365963
}

0 commit comments

Comments
 (0)