Switch from using checkbox to dropdown

This commit is contained in:
sunshineinabox 2024-02-04 22:27:46 -08:00
parent af18eb84e6
commit 974f6cd3f5
14 changed files with 140 additions and 37 deletions

View file

@ -141,7 +141,7 @@
"SettingsTabGraphics": "Graphics", "SettingsTabGraphics": "Graphics",
"SettingsTabGraphicsAPI": "Graphics API", "SettingsTabGraphicsAPI": "Graphics API",
"SettingsTabGraphicsEnableShaderCache": "Enable Shader Cache", "SettingsTabGraphicsEnableShaderCache": "Enable Shader Cache",
"SettingsTabGraphicsEnableOGLSpirV": "Enable SPIR-V Shaders on OpenGL", "SettingsTabGraphicsShadingLanguge": "Shading Language",
"SettingsTabGraphicsAnisotropicFiltering": "Anisotropic Filtering:", "SettingsTabGraphicsAnisotropicFiltering": "Anisotropic Filtering:",
"SettingsTabGraphicsAnisotropicFilteringAuto": "Auto", "SettingsTabGraphicsAnisotropicFilteringAuto": "Auto",
"SettingsTabGraphicsAnisotropicFiltering2x": "2x", "SettingsTabGraphicsAnisotropicFiltering2x": "2x",
@ -470,7 +470,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.", "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.", "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.", "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.", "ShadingLanguageTooltip": "Use SPIR-V Shaders in OpenGL. GLSL on Vulkan not currently supported. Default for OpenGL is GLSL and Vulkan is SPIR-V.\n\nLeave Defaults if unsure.",
"ResolutionScaleTooltip": "Resolution Scale applied to applicable render targets", "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.", "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)", "AnisotropyTooltip": "Level of Anisotropic Filtering (set to Auto to use the value requested by the game)",

View file

@ -48,6 +48,7 @@ namespace Ryujinx.Ava.UI.ViewModels
private readonly List<string> _gpuIds = new(); private readonly List<string> _gpuIds = new();
private KeyboardHotkeys _keyboardHotkeys; private KeyboardHotkeys _keyboardHotkeys;
private int _graphicsBackendIndex; private int _graphicsBackendIndex;
private int _shadinglanguageBackendIndex;
private string _customThemePath; private string _customThemePath;
private int _scalingFilter; private int _scalingFilter;
private int _scalingFilterLevel; private int _scalingFilterLevel;
@ -144,7 +145,6 @@ namespace Ryujinx.Ava.UI.ViewModels
public bool IgnoreMissingServices { get; set; } public bool IgnoreMissingServices { get; set; }
public bool ExpandDramSize { get; set; } public bool ExpandDramSize { get; set; }
public bool EnableShaderCache { get; set; } public bool EnableShaderCache { get; set; }
public bool EnableOGLSpirV { get; set; }
public bool EnableTextureRecompression { get; set; } public bool EnableTextureRecompression { get; set; }
public bool EnableMacroHLE { get; set; } public bool EnableMacroHLE { get; set; }
public bool EnableColorSpacePassthrough { get; set; } public bool EnableColorSpacePassthrough { get; set; }
@ -166,6 +166,8 @@ namespace Ryujinx.Ava.UI.ViewModels
public bool IsScalingFilterActive => _scalingFilter == (int)Ryujinx.Common.Configuration.ScalingFilter.Fsr; public bool IsScalingFilterActive => _scalingFilter == (int)Ryujinx.Common.Configuration.ScalingFilter.Fsr;
public bool IsVulkanSelected => GraphicsBackendIndex == 0; public bool IsVulkanSelected => GraphicsBackendIndex == 0;
public bool IsSpirVSelected => ShadingLangugeIndex == 0;
public bool IsOGSpirVAvialble => true;
public bool UseHypervisor { get; set; } public bool UseHypervisor { get; set; }
public string TimeZone { get; set; } public string TimeZone { get; set; }
@ -218,6 +220,18 @@ namespace Ryujinx.Ava.UI.ViewModels
} }
} }
public int ShadingLangugeIndex
{
get => _shadinglanguageBackendIndex;
set
{
_shadinglanguageBackendIndex = value;
OnPropertyChanged();
OnPropertyChanged(nameof(IsOpenGLSelected));
}
}
public bool IsOpenGLSelected => !IsVulkanSelected; public bool IsOpenGLSelected => !IsVulkanSelected;
public int ScalingFilter public int ScalingFilter
@ -252,6 +266,7 @@ namespace Ryujinx.Ava.UI.ViewModels
internal AvaloniaList<TimeZone> TimeZones { get; set; } internal AvaloniaList<TimeZone> TimeZones { get; set; }
public AvaloniaList<string> GameDirectories { get; set; } public AvaloniaList<string> GameDirectories { get; set; }
public ObservableCollection<ComboBoxItem> AvailableGpus { get; set; } public ObservableCollection<ComboBoxItem> AvailableGpus { get; set; }
//public ObservableCollection<ComboBoxItem> ShadingLanguage { get; set; }
public AvaloniaList<string> NetworkInterfaceList public AvaloniaList<string> NetworkInterfaceList
{ {
@ -309,6 +324,7 @@ namespace Ryujinx.Ava.UI.ViewModels
GameDirectories = new AvaloniaList<string>(); GameDirectories = new AvaloniaList<string>();
TimeZones = new AvaloniaList<TimeZone>(); TimeZones = new AvaloniaList<TimeZone>();
AvailableGpus = new ObservableCollection<ComboBoxItem>(); AvailableGpus = new ObservableCollection<ComboBoxItem>();
//ShadingLanguage = new ObservableCollection<ComboBoxItem>();
_validTzRegions = new List<string>(); _validTzRegions = new List<string>();
_networkInterfaces = new Dictionary<string, string>(); _networkInterfaces = new Dictionary<string, string>();
@ -346,6 +362,7 @@ namespace Ryujinx.Ava.UI.ViewModels
{ {
IsVulkanAvailable = false; IsVulkanAvailable = false;
GraphicsBackendIndex = 1; GraphicsBackendIndex = 1;
ShadingLangugeIndex = 1;
} }
else else
{ {
@ -465,9 +482,9 @@ namespace Ryujinx.Ava.UI.ViewModels
// Graphics // Graphics
GraphicsBackendIndex = (int)config.Graphics.GraphicsBackend.Value; GraphicsBackendIndex = (int)config.Graphics.GraphicsBackend.Value;
ShadingLangugeIndex = (int)config.Graphics.ShadingLanguage.Value;
// Physical devices are queried asynchronously hence the prefered index config value is loaded in LoadAvailableGpus(). // Physical devices are queried asynchronously hence the prefered index config value is loaded in LoadAvailableGpus().
EnableShaderCache = config.Graphics.EnableShaderCache; EnableShaderCache = config.Graphics.EnableShaderCache;
EnableOGLSpirV = config.Graphics.EnableOGLSpirV;
EnableTextureRecompression = config.Graphics.EnableTextureRecompression; EnableTextureRecompression = config.Graphics.EnableTextureRecompression;
EnableMacroHLE = config.Graphics.EnableMacroHLE; EnableMacroHLE = config.Graphics.EnableMacroHLE;
EnableColorSpacePassthrough = config.Graphics.EnableColorSpacePassthrough; EnableColorSpacePassthrough = config.Graphics.EnableColorSpacePassthrough;
@ -555,9 +572,9 @@ namespace Ryujinx.Ava.UI.ViewModels
// Graphics // Graphics
config.Graphics.GraphicsBackend.Value = (GraphicsBackend)GraphicsBackendIndex; config.Graphics.GraphicsBackend.Value = (GraphicsBackend)GraphicsBackendIndex;
config.Graphics.ShadingLanguage.Value = (ShadingLanguage)ShadingLangugeIndex;
config.Graphics.PreferredGpu.Value = _gpuIds.ElementAtOrDefault(PreferredGpuIndex); config.Graphics.PreferredGpu.Value = _gpuIds.ElementAtOrDefault(PreferredGpuIndex);
config.Graphics.EnableShaderCache.Value = EnableShaderCache; config.Graphics.EnableShaderCache.Value = EnableShaderCache;
config.Graphics.EnableOGLSpirV.Value = EnableOGLSpirV;
config.Graphics.EnableTextureRecompression.Value = EnableTextureRecompression; config.Graphics.EnableTextureRecompression.Value = EnableTextureRecompression;
config.Graphics.EnableMacroHLE.Value = EnableMacroHLE; config.Graphics.EnableMacroHLE.Value = EnableMacroHLE;
config.Graphics.EnableColorSpacePassthrough.Value = EnableColorSpacePassthrough; config.Graphics.EnableColorSpacePassthrough.Value = EnableColorSpacePassthrough;

View file

@ -56,6 +56,23 @@
SelectedIndex="{Binding PreferredGpuIndex}" SelectedIndex="{Binding PreferredGpuIndex}"
ItemsSource="{Binding AvailableGpus}"/> ItemsSource="{Binding AvailableGpus}"/>
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock VerticalAlignment="Center"
ToolTip.Tip="{locale:Locale ShadingLanguageTooltip}"
Text="{locale:Locale SettingsTabGraphicsShadingLanguge}"
Width="250" />
<ComboBox Width="350"
HorizontalContentAlignment="Left"
ToolTip.Tip="{locale:Locale ShadingLanguageTooltip}"
SelectedIndex="{Binding ShadingLangugeIndex}">
<ComboBoxItem IsEnabled="{Binding IsOGSpirVAvialble}">
<TextBlock Text="SPIR-V" />
</ComboBoxItem>
<ComboBoxItem IsEnabled="{Binding IsOpenGLSelected}">
<TextBlock Text="GLSL" />
</ComboBoxItem>
</ComboBox>
</StackPanel>
</StackPanel> </StackPanel>
<Separator Height="1" /> <Separator Height="1" />
<TextBlock Classes="h1" Text="{locale:Locale SettingsTabGraphicsFeatures}" /> <TextBlock Classes="h1" Text="{locale:Locale SettingsTabGraphicsFeatures}" />
@ -65,10 +82,6 @@
ToolTip.Tip="{locale:Locale ShaderCacheToggleTooltip}"> ToolTip.Tip="{locale:Locale ShaderCacheToggleTooltip}">
<TextBlock Text="{locale:Locale SettingsTabGraphicsEnableShaderCache}" /> <TextBlock Text="{locale:Locale SettingsTabGraphicsEnableShaderCache}" />
</CheckBox> </CheckBox>
<CheckBox IsChecked="{Binding EnableOGLSpirV}" IsVisible="{Binding IsOpenGLSelected}"
ToolTip.Tip="{locale:Locale OGLSpirVTooltip}">
<TextBlock Text="{locale:Locale SettingsTabGraphicsEnableOGLSpirV}" />
</CheckBox>
<CheckBox IsChecked="{Binding EnableTextureRecompression}" <CheckBox IsChecked="{Binding EnableTextureRecompression}"
ToolTip.Tip="{locale:Locale SettingsEnableTextureRecompressionTooltip}"> ToolTip.Tip="{locale:Locale SettingsEnableTextureRecompressionTooltip}">
<TextBlock Text="{locale:Locale SettingsEnableTextureRecompression}" /> <TextBlock Text="{locale:Locale SettingsEnableTextureRecompression}" />

View file

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

View file

@ -0,0 +1,12 @@
using Ryujinx.Common.Utilities;
using System.Text.Json.Serialization;
namespace Ryujinx.Common.Configuration
{
[JsonConverter(typeof(TypedStringEnumConverter<ShadingLanguage>))]
public enum ShadingLanguage
{
SPIRV,
GLSL,
}
}

View file

@ -1,3 +1,5 @@
using Ryujinx.Common.Configuration;
namespace Ryujinx.Graphics.Gpu namespace Ryujinx.Graphics.Gpu
{ {
#pragma warning disable CA2211 // Non-constant fields should not be visible #pragma warning disable CA2211 // Non-constant fields should not be visible
@ -61,7 +63,7 @@ namespace Ryujinx.Graphics.Gpu
/// <summary> /// <summary>
/// Enables or disables Spir-V on OpenGL. /// Enables or disables Spir-V on OpenGL.
/// </summary> /// </summary>
public static bool EnableOGLSpirV = false; public static ShadingLanguage EnableOGLSpirV = ShadingLanguage.SPIRV;
/// <summary> /// <summary>
/// Enables or disables shader SPIR-V compilation. /// Enables or disables shader SPIR-V compilation.

View file

@ -1,3 +1,4 @@
using Ryujinx.Common.Configuration;
using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Shader; using Ryujinx.Graphics.Shader;
using Ryujinx.Graphics.Shader.Translation; using Ryujinx.Graphics.Shader.Translation;
@ -396,7 +397,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
IProgram hostProgram; IProgram hostProgram;
if (context.Capabilities.Api == TargetApi.Vulkan || GraphicsConfig.EnableOGLSpirV) if (context.Capabilities.Api == TargetApi.Vulkan || (GraphicsConfig.EnableOGLSpirV == ShadingLanguage.SPIRV))
{ {
ShaderSource[] shaderSources = ShaderBinarySerializer.Unpack(shaders, hostCode); ShaderSource[] shaderSources = ShaderBinarySerializer.Unpack(shaders, hostCode);

View file

@ -1,3 +1,4 @@
using Ryujinx.Common.Configuration;
using Ryujinx.Common.Logging; using Ryujinx.Common.Logging;
using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.Shader; using Ryujinx.Graphics.Shader;
@ -504,7 +505,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
CachedShaderProgram program = new(hostProgram, compilation.SpecializationState, compilation.Shaders); CachedShaderProgram program = new(hostProgram, compilation.SpecializationState, compilation.Shaders);
// Vulkan's binary code is the SPIR-V used for compilation, so it is ready immediately. Other APIs get this after compilation. // Vulkan's binary code is the SPIR-V used for compilation, so it is ready immediately. Other APIs get this after compilation.
byte[] binaryCode = (_context.Capabilities.Api == TargetApi.Vulkan || GraphicsConfig.EnableOGLSpirV) ? ShaderBinarySerializer.Pack(shaderSources) : null; byte[] binaryCode = (_context.Capabilities.Api == TargetApi.Vulkan || (GraphicsConfig.EnableOGLSpirV == ShadingLanguage.SPIRV)) ? ShaderBinarySerializer.Pack(shaderSources) : null;
EnqueueForValidation(new ProgramEntry(program, binaryCode, compilation.ProgramIndex, compilation.IsCompute, isBinary: false)); EnqueueForValidation(new ProgramEntry(program, binaryCode, compilation.ProgramIndex, compilation.IsCompute, isBinary: false));
} }

View file

@ -560,7 +560,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
{ {
if (_diskCacheHostStorage.CacheEnabled) if (_diskCacheHostStorage.CacheEnabled)
{ {
byte[] binaryCode = (_context.Capabilities.Api == TargetApi.Vulkan || GraphicsConfig.EnableOGLSpirV) ? ShaderBinarySerializer.Pack(sources) : null; byte[] binaryCode = (_context.Capabilities.Api == TargetApi.Vulkan || (GraphicsConfig.EnableOGLSpirV == ShadingLanguage.SPIRV)) ? ShaderBinarySerializer.Pack(sources) : null;
ProgramToSave programToSave = new(program, hostProgram, binaryCode); ProgramToSave programToSave = new(program, hostProgram, binaryCode);
_programsToSaveQueue.Enqueue(programToSave); _programsToSaveQueue.Enqueue(programToSave);
@ -814,7 +814,7 @@ namespace Ryujinx.Graphics.Gpu.Shader
/// <returns>Translation options</returns> /// <returns>Translation options</returns>
private static TranslationOptions CreateTranslationOptions(TargetApi api, TranslationFlags flags) private static TranslationOptions CreateTranslationOptions(TargetApi api, TranslationFlags flags)
{ {
TargetLanguage lang = (GraphicsConfig.EnableSpirvCompilationOnVulkan && api == TargetApi.Vulkan) || (GraphicsConfig.EnableOGLSpirV && _isSpirVCapable) TargetLanguage lang = (GraphicsConfig.EnableSpirvCompilationOnVulkan && api == TargetApi.Vulkan) || ((GraphicsConfig.EnableOGLSpirV == ShadingLanguage.SPIRV) && _isSpirVCapable)
? TargetLanguage.Spirv ? TargetLanguage.Spirv
: TargetLanguage.Glsl; : TargetLanguage.Glsl;

View file

@ -381,6 +381,11 @@ namespace Ryujinx.Ui.Common.Configuration
/// </summary> /// </summary>
public bool UseHypervisor { get; set; } public bool UseHypervisor { get; set; }
/// <summary>
/// Shading Languge
/// </summary>
public ShadingLanguage ShadingLanguge { get; set; }
/// <summary> /// <summary>
/// Loads a configuration file from disk /// Loads a configuration file from disk
/// </summary> /// </summary>

View file

@ -502,6 +502,11 @@ namespace Ryujinx.Ui.Common.Configuration
/// </summary> /// </summary>
public ReactiveObject<GraphicsBackend> GraphicsBackend { get; private set; } public ReactiveObject<GraphicsBackend> GraphicsBackend { get; private set; }
/// <summary>
/// Graphics backend
/// </summary>
public ReactiveObject<ShadingLanguage> ShadingLanguage { get; private set; }
/// <summary> /// <summary>
/// Applies anti-aliasing to the renderer. /// Applies anti-aliasing to the renderer.
/// </summary> /// </summary>
@ -545,6 +550,8 @@ namespace Ryujinx.Ui.Common.Configuration
EnableTextureRecompression.Event += static (sender, e) => LogValueChange(e, nameof(EnableTextureRecompression)); EnableTextureRecompression.Event += static (sender, e) => LogValueChange(e, nameof(EnableTextureRecompression));
GraphicsBackend = new ReactiveObject<GraphicsBackend>(); GraphicsBackend = new ReactiveObject<GraphicsBackend>();
GraphicsBackend.Event += static (sender, e) => LogValueChange(e, nameof(GraphicsBackend)); GraphicsBackend.Event += static (sender, e) => LogValueChange(e, nameof(GraphicsBackend));
ShadingLanguage = new ReactiveObject<ShadingLanguage>();
ShadingLanguage.Event += static (sender, e) => LogValueChange(e, nameof(ShadingLanguage));
PreferredGpu = new ReactiveObject<string>(); PreferredGpu = new ReactiveObject<string>();
PreferredGpu.Event += static (sender, e) => LogValueChange(e, nameof(PreferredGpu)); PreferredGpu.Event += static (sender, e) => LogValueChange(e, nameof(PreferredGpu));
EnableMacroHLE = new ReactiveObject<bool>(); EnableMacroHLE = new ReactiveObject<bool>();
@ -757,6 +764,7 @@ namespace Ryujinx.Ui.Common.Configuration
InputConfig = Hid.InputConfig, InputConfig = Hid.InputConfig,
GraphicsBackend = Graphics.GraphicsBackend, GraphicsBackend = Graphics.GraphicsBackend,
PreferredGpu = Graphics.PreferredGpu, PreferredGpu = Graphics.PreferredGpu,
ShadingLanguge = Graphics.ShadingLanguage,
MultiplayerLanInterfaceId = Multiplayer.LanInterfaceId, MultiplayerLanInterfaceId = Multiplayer.LanInterfaceId,
MultiplayerMode = Multiplayer.Mode, MultiplayerMode = Multiplayer.Mode,
}; };
@ -773,6 +781,7 @@ namespace Ryujinx.Ui.Common.Configuration
Graphics.MaxAnisotropy.Value = -1.0f; Graphics.MaxAnisotropy.Value = -1.0f;
Graphics.AspectRatio.Value = AspectRatio.Fixed16x9; Graphics.AspectRatio.Value = AspectRatio.Fixed16x9;
Graphics.GraphicsBackend.Value = DefaultGraphicsBackend(); Graphics.GraphicsBackend.Value = DefaultGraphicsBackend();
Graphics.ShadingLanguage.Value = DefaultShadingLanguge();
Graphics.PreferredGpu.Value = ""; Graphics.PreferredGpu.Value = "";
Graphics.ShadersDumpPath.Value = ""; Graphics.ShadersDumpPath.Value = "";
Logger.EnableDebug.Value = false; Logger.EnableDebug.Value = false;
@ -1443,7 +1452,7 @@ namespace Ryujinx.Ui.Common.Configuration
{ {
Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 49."); Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 49.");
configurationFileFormat.EnableOGLSpirV = false; configurationFileFormat.ShadingLanguge = ShadingLanguage.SPIRV;
configurationFileUpdated = true; configurationFileUpdated = true;
} }
@ -1457,6 +1466,7 @@ namespace Ryujinx.Ui.Common.Configuration
Graphics.BackendThreading.Value = configurationFileFormat.BackendThreading; Graphics.BackendThreading.Value = configurationFileFormat.BackendThreading;
Graphics.GraphicsBackend.Value = configurationFileFormat.GraphicsBackend; Graphics.GraphicsBackend.Value = configurationFileFormat.GraphicsBackend;
Graphics.PreferredGpu.Value = configurationFileFormat.PreferredGpu; Graphics.PreferredGpu.Value = configurationFileFormat.PreferredGpu;
Graphics.ShadingLanguage.Value = configurationFileFormat.ShadingLanguge;
Graphics.AntiAliasing.Value = configurationFileFormat.AntiAliasing; Graphics.AntiAliasing.Value = configurationFileFormat.AntiAliasing;
Graphics.ScalingFilter.Value = configurationFileFormat.ScalingFilter; Graphics.ScalingFilter.Value = configurationFileFormat.ScalingFilter;
Graphics.ScalingFilterLevel.Value = configurationFileFormat.ScalingFilterLevel; Graphics.ScalingFilterLevel.Value = configurationFileFormat.ScalingFilterLevel;
@ -1563,6 +1573,18 @@ namespace Ryujinx.Ui.Common.Configuration
return GraphicsBackend.OpenGl; return GraphicsBackend.OpenGl;
} }
private static ShadingLanguage DefaultShadingLanguge()
{
// Any system running macOS or returning any amount of valid Vulkan devices should default to Vulkan.
// Checks for if the Vulkan version and featureset is compatible should be performed within VulkanRenderer.
if (DefaultGraphicsBackend() == GraphicsBackend.Vulkan)
{
return ShadingLanguage.SPIRV;
}
return ShadingLanguage.GLSL;
}
private static void LogValueChange<T>(ReactiveEventArgs<T> eventArgs, string valueName) private static void LogValueChange<T>(ReactiveEventArgs<T> eventArgs, string valueName)
{ {
Ryujinx.Common.Logging.Logger.Info?.Print(LogClass.Configuration, $"{valueName} set to: {eventArgs.NewValue}"); Ryujinx.Common.Logging.Logger.Info?.Print(LogClass.Configuration, $"{valueName} set to: {eventArgs.NewValue}");

View file

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

View file

@ -104,6 +104,7 @@ namespace Ryujinx.Ui.Windows
[GUI] ComboBoxText _antiAliasing; [GUI] ComboBoxText _antiAliasing;
[GUI] ComboBoxText _scalingFilter; [GUI] ComboBoxText _scalingFilter;
[GUI] ComboBoxText _graphicsBackend; [GUI] ComboBoxText _graphicsBackend;
[GUI] ComboBoxText _shadingLanguage;
[GUI] ComboBoxText _preferredGpu; [GUI] ComboBoxText _preferredGpu;
[GUI] ComboBoxText _resScaleCombo; [GUI] ComboBoxText _resScaleCombo;
[GUI] Entry _resScaleText; [GUI] Entry _resScaleText;
@ -362,6 +363,7 @@ namespace Ryujinx.Ui.Windows
_anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString()); _anisotropy.SetActiveId(ConfigurationState.Instance.Graphics.MaxAnisotropy.Value.ToString());
_aspectRatio.SetActiveId(((int)ConfigurationState.Instance.Graphics.AspectRatio.Value).ToString()); _aspectRatio.SetActiveId(((int)ConfigurationState.Instance.Graphics.AspectRatio.Value).ToString());
_graphicsBackend.SetActiveId(((int)ConfigurationState.Instance.Graphics.GraphicsBackend.Value).ToString()); _graphicsBackend.SetActiveId(((int)ConfigurationState.Instance.Graphics.GraphicsBackend.Value).ToString());
_shadingLanguage.SetActiveId(((int)ConfigurationState.Instance.Graphics.ShadingLanguage.Value).ToString());
_antiAliasing.SetActiveId(((int)ConfigurationState.Instance.Graphics.AntiAliasing.Value).ToString()); _antiAliasing.SetActiveId(((int)ConfigurationState.Instance.Graphics.AntiAliasing.Value).ToString());
_scalingFilter.SetActiveId(((int)ConfigurationState.Instance.Graphics.ScalingFilter.Value).ToString()); _scalingFilter.SetActiveId(((int)ConfigurationState.Instance.Graphics.ScalingFilter.Value).ToString());
@ -658,6 +660,7 @@ namespace Ryujinx.Ui.Windows
ConfigurationState.Instance.Graphics.AspectRatio.Value = Enum.Parse<AspectRatio>(_aspectRatio.ActiveId); ConfigurationState.Instance.Graphics.AspectRatio.Value = Enum.Parse<AspectRatio>(_aspectRatio.ActiveId);
ConfigurationState.Instance.Graphics.BackendThreading.Value = backendThreading; ConfigurationState.Instance.Graphics.BackendThreading.Value = backendThreading;
ConfigurationState.Instance.Graphics.GraphicsBackend.Value = Enum.Parse<GraphicsBackend>(_graphicsBackend.ActiveId); ConfigurationState.Instance.Graphics.GraphicsBackend.Value = Enum.Parse<GraphicsBackend>(_graphicsBackend.ActiveId);
ConfigurationState.Instance.Graphics.ShadingLanguage.Value = Enum.Parse<ShadingLanguage>(_shadingLanguage.ActiveId);
ConfigurationState.Instance.Graphics.PreferredGpu.Value = _preferredGpu.ActiveId; ConfigurationState.Instance.Graphics.PreferredGpu.Value = _preferredGpu.ActiveId;
ConfigurationState.Instance.Graphics.ResScale.Value = int.Parse(_resScaleCombo.ActiveId); ConfigurationState.Instance.Graphics.ResScale.Value = int.Parse(_resScaleCombo.ActiveId);
ConfigurationState.Instance.Graphics.ResScaleCustom.Value = resScaleCustom; ConfigurationState.Instance.Graphics.ResScaleCustom.Value = resScaleCustom;

View file

@ -2071,6 +2071,51 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </child>
<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">Shading Language to use</property>
<property name="label" translatable="yes">Shading Language:</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="_shadingLanguage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="tooltip-text" translatable="yes">Shading Language to use</property>
<property name="active-id">-1</property>
<items>
<item id="0" translatable="yes">SPIR-V</item>
<item id="1" translatable="yes">GLSL</item>
</items>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
<child> <child>
<object class="GtkBox" id="CatEnhancements"> <object class="GtkBox" id="CatEnhancements">
<property name="visible">True</property> <property name="visible">True</property>
@ -2122,24 +2167,6 @@
<property name="position">0</property> <property name="position">0</property>
</packing> </packing>
</child> </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> <child>
<object class="GtkCheckButton" id="_textureRecompressionToggle"> <object class="GtkCheckButton" id="_textureRecompressionToggle">
<property name="label" translatable="yes">Enable Texture Recompression</property> <property name="label" translatable="yes">Enable Texture Recompression</property>
@ -2155,7 +2182,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">2</property> <property name="position">1</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -2173,7 +2200,7 @@
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
<property name="position">3</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child> <child>