Checkbox to Enable not conditional yet

This commit is contained in:
sunshineinabox 2023-08-14 12:16:14 -07:00
parent 9f7d839664
commit ef9f05bdbc
11 changed files with 74 additions and 5 deletions

View file

@ -139,6 +139,7 @@
"SettingsTabGraphics": "Graphics",
"SettingsTabGraphicsAPI": "Graphics API",
"SettingsTabGraphicsEnableShaderCache": "Enable Shader Cache",
"SettingsTabGraphicsEnableOGLSpirV": "Enable Spir-V Shaders on OpenGL",
"SettingsTabGraphicsAnisotropicFiltering": "Anisotropic Filtering:",
"SettingsTabGraphicsAnisotropicFilteringAuto": "Auto",
"SettingsTabGraphicsAnisotropicFiltering2x": "2x",
@ -467,6 +468,7 @@
"GraphicsBackendThreadingTooltip": "Executes graphics backend commands on a second thread.\n\nSpeeds up shader compilation, reduces stuttering, and improves performance on GPU drivers without multithreading support of their own. Slightly better performance on drivers with multithreading.\n\nSet to AUTO if unsure.",
"GalThreadingTooltip": "Executes graphics backend commands on a second thread.\n\nSpeeds up shader compilation, reduces stuttering, and improves performance on GPU drivers without multithreading support of their own. Slightly better performance on drivers with multithreading.\n\nSet to AUTO if unsure.",
"ShaderCacheToggleTooltip": "Saves a disk shader cache which reduces stuttering in subsequent runs.\n\nLeave ON if unsure.",
"OGLSpirVTooltip": "Saves shaders as Spir-V.\n\nLeave OFF if unsure.",
"ResolutionScaleTooltip": "Resolution Scale applied to applicable render targets",
"ResolutionScaleEntryTooltip": "Floating point resolution scale, such as 1.5. Non-integral scales are more likely to cause issues or crash.",
"AnisotropyTooltip": "Level of Anisotropic Filtering (set to Auto to use the value requested by the game)",

View file

@ -143,6 +143,7 @@ namespace Ryujinx.Ava.UI.ViewModels
public bool IgnoreMissingServices { get; set; }
public bool ExpandDramSize { get; set; }
public bool EnableShaderCache { get; set; }
public bool EnableOGLSpirV { get; set; }
public bool EnableTextureRecompression { get; set; }
public bool EnableMacroHLE { get; set; }
public bool EnableColorSpacePassthrough { get; set; }
@ -211,8 +212,12 @@ namespace Ryujinx.Ava.UI.ViewModels
_graphicsBackendIndex = value;
OnPropertyChanged();
OnPropertyChanged(nameof(IsVulkanSelected));
OnPropertyChanged(nameof(IsOGLSelected));
}
}
public bool IsOGLSelected => !IsVulkanSelected;
public int ScalingFilter
{
get => _scalingFilter;
@ -445,6 +450,7 @@ namespace Ryujinx.Ava.UI.ViewModels
GraphicsBackendIndex = (int)config.Graphics.GraphicsBackend.Value;
// Physical devices are queried asynchronously hence the prefered index config value is loaded in LoadAvailableGpus().
EnableShaderCache = config.Graphics.EnableShaderCache;
EnableOGLSpirV = config.Graphics.EnableOGLSpirV;
EnableTextureRecompression = config.Graphics.EnableTextureRecompression;
EnableMacroHLE = config.Graphics.EnableMacroHLE;
EnableColorSpacePassthrough = config.Graphics.EnableColorSpacePassthrough;
@ -532,6 +538,7 @@ namespace Ryujinx.Ava.UI.ViewModels
config.Graphics.GraphicsBackend.Value = (GraphicsBackend)GraphicsBackendIndex;
config.Graphics.PreferredGpu.Value = _gpuIds.ElementAtOrDefault(PreferredGpuIndex);
config.Graphics.EnableShaderCache.Value = EnableShaderCache;
config.Graphics.EnableOGLSpirV.Value = EnableOGLSpirV;
config.Graphics.EnableTextureRecompression.Value = EnableTextureRecompression;
config.Graphics.EnableMacroHLE.Value = EnableMacroHLE;
config.Graphics.EnableColorSpacePassthrough.Value = EnableColorSpacePassthrough;

View file

@ -64,6 +64,10 @@
ToolTip.Tip="{locale:Locale ShaderCacheToggleTooltip}">
<TextBlock Text="{locale:Locale SettingsTabGraphicsEnableShaderCache}" />
</CheckBox>
<CheckBox IsChecked="{Binding EnableOGLSpirV}" IsVisible="{Binding IsOGLSelected}"
ToolTip.Tip="{locale:Locale OGLSpirVTooltip}">
<TextBlock Text="{locale:Locale SettingsTabGraphicsEnableOGLSpirV}" />
</CheckBox>
<CheckBox IsChecked="{Binding EnableTextureRecompression}"
ToolTip.Tip="{locale:Locale SettingsEnableTextureRecompressionTooltip}">
<TextBlock Text="{locale:Locale SettingsEnableTextureRecompression}" />

View file

@ -435,6 +435,7 @@ namespace Ryujinx.Ava.UI.Windows
GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy;
GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath;
GraphicsConfig.EnableShaderCache = ConfigurationState.Instance.Graphics.EnableShaderCache;
GraphicsConfig.EnableOGLSpirV = ConfigurationState.Instance.Graphics.EnableOGLSpirV;
GraphicsConfig.EnableTextureRecompression = ConfigurationState.Instance.Graphics.EnableTextureRecompression;
GraphicsConfig.EnableMacroHLE = ConfigurationState.Instance.Graphics.EnableMacroHLE;
#pragma warning restore IDE0055

View file

@ -58,6 +58,11 @@ namespace Ryujinx.Graphics.Gpu
/// </summary>
public static bool EnableShaderCache;
/// <summary>
/// Enables or disables color space passthrough, if available.
/// </summary>
public static bool EnableOGLSpirV = false;
/// <summary>
/// Enables or disables shader SPIR-V compilation.
/// </summary>

View file

@ -727,7 +727,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// <returns>Translation options</returns>
private static TranslationOptions CreateTranslationOptions(TargetApi api, TranslationFlags flags)
{
TargetLanguage lang = GraphicsConfig.EnableSpirvCompilationOnVulkan && api == TargetApi.Vulkan
TargetLanguage lang = (GraphicsConfig.EnableSpirvCompilationOnVulkan && api == TargetApi.Vulkan) || (GraphicsConfig.EnableOGLSpirV && api == TargetApi.OpenGL)
? TargetLanguage.Spirv
: TargetLanguage.Glsl;

View file

@ -176,6 +176,11 @@ namespace Ryujinx.Ui.Common.Configuration
/// </summary>
public bool EnableShaderCache { get; set; }
/// <summary>
/// Enables or disables Spir-V Shaders on OpenGL
/// </summary>
public bool EnableOGLSpirV { get; set; }
/// <summary>
/// Enables or disables texture recompression
/// </summary>

View file

@ -475,6 +475,11 @@ namespace Ryujinx.Ui.Common.Configuration
/// </summary>
public ReactiveObject<bool> EnableShaderCache { get; private set; }
/// <summary>
/// Enables or disables Spir-V Shaders on OpenGL
/// </summary>
public ReactiveObject<bool> EnableOGLSpirV { get; private set; }
/// <summary>
/// Enables or disables texture recompression
/// </summary>
@ -532,6 +537,8 @@ namespace Ryujinx.Ui.Common.Configuration
EnableVsync.Event += static (sender, e) => LogValueChange(e, nameof(EnableVsync));
EnableShaderCache = new ReactiveObject<bool>();
EnableShaderCache.Event += static (sender, e) => LogValueChange(e, nameof(EnableShaderCache));
EnableOGLSpirV = new ReactiveObject<bool>();
EnableOGLSpirV.Event += static (sender, e) => LogValueChange(e, nameof(EnableOGLSpirV));
EnableTextureRecompression = new ReactiveObject<bool>();
EnableTextureRecompression.Event += static (sender, e) => LogValueChange(e, nameof(EnableTextureRecompression));
GraphicsBackend = new ReactiveObject<GraphicsBackend>();
@ -672,6 +679,7 @@ namespace Ryujinx.Ui.Common.Configuration
HideCursor = HideCursor,
EnableVsync = Graphics.EnableVsync,
EnableShaderCache = Graphics.EnableShaderCache,
EnableOGLSpirV = Graphics.EnableOGLSpirV,
EnableTextureRecompression = Graphics.EnableTextureRecompression,
EnableMacroHLE = Graphics.EnableMacroHLE,
EnableColorSpacePassthrough = Graphics.EnableColorSpacePassthrough,
@ -778,6 +786,7 @@ namespace Ryujinx.Ui.Common.Configuration
HideCursor.Value = HideCursorMode.Never;
Graphics.EnableVsync.Value = true;
Graphics.EnableShaderCache.Value = true;
Graphics.EnableOGLSpirV.Value = false;
Graphics.EnableTextureRecompression.Value = false;
Graphics.EnableMacroHLE.Value = true;
Graphics.EnableColorSpacePassthrough.Value = false;
@ -1409,6 +1418,15 @@ namespace Ryujinx.Ui.Common.Configuration
configurationFileUpdated = true;
}
if (configurationFileFormat.Version < 49)
{
Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 48.");
configurationFileFormat.EnableOGLSpirV = false;
configurationFileUpdated = true;
}
Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
Graphics.ResScale.Value = configurationFileFormat.ResScale;
Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
@ -1442,6 +1460,7 @@ namespace Ryujinx.Ui.Common.Configuration
HideCursor.Value = configurationFileFormat.HideCursor;
Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync;
Graphics.EnableShaderCache.Value = configurationFileFormat.EnableShaderCache;
Graphics.EnableOGLSpirV.Value = configurationFileFormat.EnableOGLSpirV;
Graphics.EnableTextureRecompression.Value = configurationFileFormat.EnableTextureRecompression;
Graphics.EnableMacroHLE.Value = configurationFileFormat.EnableMacroHLE;
Graphics.EnableColorSpacePassthrough.Value = configurationFileFormat.EnableColorSpacePassthrough;

View file

@ -1096,6 +1096,7 @@ namespace Ryujinx.Ui
Graphics.Gpu.GraphicsConfig.MaxAnisotropy = ConfigurationState.Instance.Graphics.MaxAnisotropy;
Graphics.Gpu.GraphicsConfig.ShadersDumpPath = ConfigurationState.Instance.Graphics.ShadersDumpPath;
Graphics.Gpu.GraphicsConfig.EnableShaderCache = ConfigurationState.Instance.Graphics.EnableShaderCache;
Graphics.Gpu.GraphicsConfig.EnableOGLSpirV = ConfigurationState.Instance.Graphics.EnableOGLSpirV;
Graphics.Gpu.GraphicsConfig.EnableTextureRecompression = ConfigurationState.Instance.Graphics.EnableTextureRecompression;
Graphics.Gpu.GraphicsConfig.EnableMacroHLE = ConfigurationState.Instance.Graphics.EnableMacroHLE;
}

View file

@ -56,6 +56,7 @@ namespace Ryujinx.Ui.Windows
[GUI] RadioButton _hideCursorAlways;
[GUI] CheckButton _vSyncToggle;
[GUI] CheckButton _shaderCacheToggle;
[GUI] CheckButton _enableOGLSpirV;
[GUI] CheckButton _textureRecompressionToggle;
[GUI] CheckButton _macroHLEToggle;
[GUI] CheckButton _ptcToggle;
@ -250,6 +251,11 @@ namespace Ryujinx.Ui.Windows
_shaderCacheToggle.Click();
}
if (ConfigurationState.Instance.Graphics.EnableOGLSpirV)
{
_enableOGLSpirV.Click();
}
if (ConfigurationState.Instance.Graphics.EnableTextureRecompression)
{
_textureRecompressionToggle.Click();
@ -626,6 +632,7 @@ namespace Ryujinx.Ui.Windows
ConfigurationState.Instance.HideCursor.Value = hideCursor;
ConfigurationState.Instance.Graphics.EnableVsync.Value = _vSyncToggle.Active;
ConfigurationState.Instance.Graphics.EnableShaderCache.Value = _shaderCacheToggle.Active;
ConfigurationState.Instance.Graphics.EnableOGLSpirV.Value = _enableOGLSpirV.Active;
ConfigurationState.Instance.Graphics.EnableTextureRecompression.Value = _textureRecompressionToggle.Active;
ConfigurationState.Instance.Graphics.EnableMacroHLE.Value = _macroHLEToggle.Active;
ConfigurationState.Instance.System.EnablePtc.Value = _ptcToggle.Active;

View file

@ -2122,6 +2122,24 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="_enableOGLSpirV">
<property name="label" translatable="yes">Enable Spir-V Shader in OpenGL</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="tooltip-text" translatable="yes">Uses shaders in Spir-V format.&#13;Leave OFF if unsure.</property>
<property name="halign">start</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="_textureRecompressionToggle">
<property name="label" translatable="yes">Enable Texture Recompression</property>
@ -2137,7 +2155,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
@ -2155,7 +2173,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
<child>