mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-08-02 21:37:10 +02:00
Implement Zero-Configuration Resolution Scaling (#1365)
* Initial implementation of Render Target Scaling Works with most games I have. No GUI option right now, it is hardcoded. Missing handling for texelFetch operation. * Realtime Configuration, refactoring. * texelFetch scaling on fragment shader (WIP) * Improve Shader-Side changes. * Fix potential crash when no color/depth bound * Workaround random uses of textures in compute. This was blacklisting textures in a few games despite causing no bugs. Will eventually add full support so this doesn't break anything. * Fix scales oscillating when changing between non-native scales. * Scaled textures on compute, cleanup, lazier uniform update. * Cleanup. * Fix stupidity * Address Thog Feedback. * Cover most of GDK's feedback (two comments remain) * Fix bad rename * Move IsDepthStencil to FormatExtensions, add docs. * Fix default config, square texture detection. * Three final fixes: - Nearest copy when texture is integer format. - Texture2D -> Texture3D copy correctly blacklists the texture before trying an unscaled copy (caused driver error) - Discount small textures. * Remove scale threshold. Not needed right now - we'll see if we run into problems. * All CPU modification blacklists scale. * Fix comment.
This commit is contained in:
parent
475230e83d
commit
90605c9a15
49 changed files with 1163 additions and 131 deletions
|
@ -1,5 +1,7 @@
|
|||
{
|
||||
"version": 10,
|
||||
"version": 11,
|
||||
"res_scale": 2,
|
||||
"res_scale_custom": 1,
|
||||
"max_anisotropy": -1,
|
||||
"graphics_shaders_dump_path": "",
|
||||
"logging_enable_debug": false,
|
||||
|
|
|
@ -328,6 +328,11 @@ namespace Ryujinx.Ui
|
|||
}
|
||||
|
||||
string dockedMode = ConfigurationState.Instance.System.EnableDockedMode ? "Docked" : "Handheld";
|
||||
float scale = Graphics.Gpu.GraphicsConfig.ResScale;
|
||||
if (scale != 1)
|
||||
{
|
||||
dockedMode += $" ({scale}x)";
|
||||
}
|
||||
|
||||
if (_ticks >= _ticksPerFrame)
|
||||
{
|
||||
|
|
|
@ -390,9 +390,7 @@ namespace Ryujinx.Ui
|
|||
|
||||
HLE.Switch device = InitializeSwitchInstance();
|
||||
|
||||
// TODO: Move this somewhere else + reloadable?
|
||||
Graphics.Gpu.GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy;
|
||||
Graphics.Gpu.GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath;
|
||||
UpdateGraphicsConfig();
|
||||
|
||||
Logger.PrintInfo(LogClass.Application, $"Using Firmware Version: {_contentManager.GetCurrentFirmwareVersion()?.VersionString}");
|
||||
|
||||
|
@ -605,6 +603,15 @@ namespace Ryujinx.Ui
|
|||
}
|
||||
}
|
||||
|
||||
public static void UpdateGraphicsConfig()
|
||||
{
|
||||
int resScale = ConfigurationState.Instance.Graphics.ResScale;
|
||||
float resScaleCustom = ConfigurationState.Instance.Graphics.ResScaleCustom;
|
||||
Graphics.Gpu.GraphicsConfig.ResScale = (resScale == -1) ? resScaleCustom : resScale;
|
||||
Graphics.Gpu.GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy;
|
||||
Graphics.Gpu.GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath;
|
||||
}
|
||||
|
||||
public static void SaveConfig()
|
||||
{
|
||||
ConfigurationState.Instance.ToFileFormat().SaveConfig(Program.ConfigurationPath);
|
||||
|
|
|
@ -63,6 +63,8 @@ namespace Ryujinx.Ui
|
|||
[GUI] Entry _addGameDirBox;
|
||||
[GUI] Entry _graphicsShadersDumpPath;
|
||||
[GUI] ComboBoxText _anisotropy;
|
||||
[GUI] ComboBoxText _resScaleCombo;
|
||||
[GUI] Entry _resScaleText;
|
||||
[GUI] ToggleButton _configureController1;
|
||||
[GUI] ToggleButton _configureController2;
|
||||
[GUI] ToggleButton _configureController3;
|
||||
|
@ -95,6 +97,8 @@ namespace Ryujinx.Ui
|
|||
_configureController8.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Player8);
|
||||
_configureControllerH.Pressed += (sender, args) => ConfigureController_Pressed(sender, args, PlayerIndex.Handheld);
|
||||
|
||||
_resScaleCombo.Changed += (sender, args) => _resScaleText.Visible = _resScaleCombo.ActiveId == "-1";
|
||||
|
||||
//Setup Currents
|
||||
if (ConfigurationState.Instance.Logger.EnableFileLog)
|
||||
{
|
||||
|
@ -204,9 +208,12 @@ namespace Ryujinx.Ui
|
|||
_systemRegionSelect.SetActiveId(ConfigurationState.Instance.System.Region.Value.ToString());
|
||||
_audioBackendSelect.SetActiveId(ConfigurationState.Instance.System.AudioBackend.Value.ToString());
|
||||
_systemTimeZoneSelect.SetActiveId(timeZoneContentManager.SanityCheckDeviceLocationName());
|
||||
_resScaleCombo.SetActiveId(ConfigurationState.Instance.Graphics.ResScale.Value.ToString());
|
||||
_anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString());
|
||||
|
||||
_custThemePath.Buffer.Text = ConfigurationState.Instance.Ui.CustomThemePath;
|
||||
_resScaleText.Buffer.Text = ConfigurationState.Instance.Graphics.ResScaleCustom.Value.ToString();
|
||||
_resScaleText.Visible = _resScaleCombo.ActiveId == "-1";
|
||||
_graphicsShadersDumpPath.Buffer.Text = ConfigurationState.Instance.Graphics.ShadersDumpPath;
|
||||
_fsLogSpinAdjustment.Value = ConfigurationState.Instance.System.FsGlobalAccessLogMode;
|
||||
_systemTimeOffset = ConfigurationState.Instance.System.SystemTimeOffset;
|
||||
|
@ -408,6 +415,12 @@ namespace Ryujinx.Ui
|
|||
_gameDirsBoxStore.IterNext(ref treeIter);
|
||||
}
|
||||
|
||||
float resScaleCustom;
|
||||
if (!float.TryParse(_resScaleText.Buffer.Text, out resScaleCustom) || resScaleCustom <= 0.0f)
|
||||
{
|
||||
resScaleCustom = 1.0f;
|
||||
}
|
||||
|
||||
ConfigurationState.Instance.Logger.EnableError.Value = _errorLogToggle.Active;
|
||||
ConfigurationState.Instance.Logger.EnableWarn.Value = _warningLogToggle.Active;
|
||||
ConfigurationState.Instance.Logger.EnableInfo.Value = _infoLogToggle.Active;
|
||||
|
@ -435,8 +448,11 @@ namespace Ryujinx.Ui
|
|||
ConfigurationState.Instance.Ui.GameDirs.Value = gameDirs;
|
||||
ConfigurationState.Instance.System.FsGlobalAccessLogMode.Value = (int)_fsLogSpinAdjustment.Value;
|
||||
ConfigurationState.Instance.Graphics.MaxAnisotropy.Value = float.Parse(_anisotropy.ActiveId);
|
||||
ConfigurationState.Instance.Graphics.ResScale.Value = int.Parse(_resScaleCombo.ActiveId);
|
||||
ConfigurationState.Instance.Graphics.ResScaleCustom.Value = resScaleCustom;
|
||||
|
||||
MainWindow.SaveConfig();
|
||||
MainWindow.UpdateGraphicsConfig();
|
||||
MainWindow.ApplyTheme();
|
||||
Dispose();
|
||||
}
|
||||
|
|
|
@ -1677,6 +1677,70 @@
|
|||
<property name="margin_left">10</property>
|
||||
<property name="margin_right">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="margin_bottom">5</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Resolution Scale applied to applicable render targets.</property>
|
||||
<property name="label" translatable="yes">Resolution Scale:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="_resScaleCombo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Resolution Scale applied to applicable render targets.</property>
|
||||
<property name="active_id">1</property>
|
||||
<items>
|
||||
<item id="1" translatable="yes">Native (720p/1080p)</item>
|
||||
<item id="2" translatable="yes">2x (1440p/2160p)</item>
|
||||
<item id="3" translatable="yes">3x (2160p/3240p)</item>
|
||||
<item id="4" translatable="yes">4x (2880p/4320p)</item>
|
||||
<item id="-1" translatable="yes">Custom (not recommended)</item>
|
||||
</items>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="_resScaleText">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Floating point resolution scale, such as 1.5. Non-integral scales are more likely to cause issues or crash.</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="caps_lock_warning">False</property>
|
||||
<property name="placeholder-text">1.0</property>
|
||||
<property name="input-purpose">GTK_INPUT_PURPOSE_NUMBER</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
|
@ -1722,7 +1786,7 @@
|
|||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">5</property>
|
||||
<property name="position">0</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -700,6 +700,27 @@
|
|||
}
|
||||
},
|
||||
"properties": {
|
||||
"res_scale": {
|
||||
"$id": "#/properties/res_scale",
|
||||
"type": "integer",
|
||||
"title": "Resolution Scale",
|
||||
"description": "An integer scale applied to applicable render targets. Values 1-4, or -1 to use a custom floating point scale instead.",
|
||||
"default": -1,
|
||||
"examples": [
|
||||
-1,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
]
|
||||
},
|
||||
"res_scale_custom": {
|
||||
"$id": "#/properties/res_scale_custom",
|
||||
"type": "number",
|
||||
"title": "Custom Resolution Scale",
|
||||
"description": "A custom floating point scale applied to applicable render targets. Only active when Resolution Scale is -1.",
|
||||
"default": 1.0,
|
||||
},
|
||||
"max_anisotropy": {
|
||||
"$id": "#/properties/max_anisotropy",
|
||||
"type": "integer",
|
||||
|
@ -1211,7 +1232,7 @@
|
|||
"button_sr": "Unbound"
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"controller_config": {
|
||||
"$id": "#/properties/controller_config",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue