mirror of
				https://github.com/ryujinx-mirror/ryujinx.git
				synced 2025-11-04 08:18:58 -06:00 
			
		
		
		
	misc: Add ANGLE configuration option to JSON and CLI (#6520)
* Add hardware-acceleration toggle to ConfigurationState. * Add command line override for easier RenderDoc use. * Adjust CLI arguments. * fix whitespace format check * fix copypasta in comment * Add X11 rendering mode toggle * Remove ANGLE specific comments.
This commit is contained in:
		@@ -15,7 +15,7 @@ namespace Ryujinx.UI.Common.Configuration
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// The current version of the file format
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public const int CurrentVersion = 49;
 | 
			
		||||
        public const int CurrentVersion = 50;
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Version of the configuration file format
 | 
			
		||||
@@ -162,6 +162,11 @@ namespace Ryujinx.UI.Common.Configuration
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public bool ShowConfirmExit { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Enables hardware-accelerated rendering for Avalonia
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public bool EnableHardwareAcceleration { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Whether to hide cursor on idle, always or never
 | 
			
		||||
        /// </summary>
 | 
			
		||||
 
 | 
			
		||||
@@ -626,6 +626,11 @@ namespace Ryujinx.UI.Common.Configuration
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public ReactiveObject<bool> ShowConfirmExit { get; private set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Enables hardware-accelerated rendering for Avalonia
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public ReactiveObject<bool> EnableHardwareAcceleration { get; private set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Hide Cursor on Idle
 | 
			
		||||
        /// </summary>
 | 
			
		||||
@@ -642,6 +647,7 @@ namespace Ryujinx.UI.Common.Configuration
 | 
			
		||||
            EnableDiscordIntegration = new ReactiveObject<bool>();
 | 
			
		||||
            CheckUpdatesOnStart = new ReactiveObject<bool>();
 | 
			
		||||
            ShowConfirmExit = new ReactiveObject<bool>();
 | 
			
		||||
            EnableHardwareAcceleration = new ReactiveObject<bool>();
 | 
			
		||||
            HideCursor = new ReactiveObject<HideCursorMode>();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -678,6 +684,7 @@ namespace Ryujinx.UI.Common.Configuration
 | 
			
		||||
                EnableDiscordIntegration = EnableDiscordIntegration,
 | 
			
		||||
                CheckUpdatesOnStart = CheckUpdatesOnStart,
 | 
			
		||||
                ShowConfirmExit = ShowConfirmExit,
 | 
			
		||||
                EnableHardwareAcceleration = EnableHardwareAcceleration,
 | 
			
		||||
                HideCursor = HideCursor,
 | 
			
		||||
                EnableVsync = Graphics.EnableVsync,
 | 
			
		||||
                EnableShaderCache = Graphics.EnableShaderCache,
 | 
			
		||||
@@ -785,6 +792,7 @@ namespace Ryujinx.UI.Common.Configuration
 | 
			
		||||
            EnableDiscordIntegration.Value = true;
 | 
			
		||||
            CheckUpdatesOnStart.Value = true;
 | 
			
		||||
            ShowConfirmExit.Value = true;
 | 
			
		||||
            EnableHardwareAcceleration.Value = true;
 | 
			
		||||
            HideCursor.Value = HideCursorMode.OnIdle;
 | 
			
		||||
            Graphics.EnableVsync.Value = true;
 | 
			
		||||
            Graphics.EnableShaderCache.Value = true;
 | 
			
		||||
@@ -1442,6 +1450,15 @@ namespace Ryujinx.UI.Common.Configuration
 | 
			
		||||
                configurationFileUpdated = true;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (configurationFileFormat.Version < 50)
 | 
			
		||||
            {
 | 
			
		||||
                Ryujinx.Common.Logging.Logger.Warning?.Print(LogClass.Application, $"Outdated configuration version {configurationFileFormat.Version}, migrating to version 50.");
 | 
			
		||||
 | 
			
		||||
                configurationFileFormat.EnableHardwareAcceleration = true;
 | 
			
		||||
 | 
			
		||||
                configurationFileUpdated = true;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            Logger.EnableFileLog.Value = configurationFileFormat.EnableFileLog;
 | 
			
		||||
            Graphics.ResScale.Value = configurationFileFormat.ResScale;
 | 
			
		||||
            Graphics.ResScaleCustom.Value = configurationFileFormat.ResScaleCustom;
 | 
			
		||||
@@ -1472,6 +1489,7 @@ namespace Ryujinx.UI.Common.Configuration
 | 
			
		||||
            EnableDiscordIntegration.Value = configurationFileFormat.EnableDiscordIntegration;
 | 
			
		||||
            CheckUpdatesOnStart.Value = configurationFileFormat.CheckUpdatesOnStart;
 | 
			
		||||
            ShowConfirmExit.Value = configurationFileFormat.ShowConfirmExit;
 | 
			
		||||
            EnableHardwareAcceleration.Value = configurationFileFormat.EnableHardwareAcceleration;
 | 
			
		||||
            HideCursor.Value = configurationFileFormat.HideCursor;
 | 
			
		||||
            Graphics.EnableVsync.Value = configurationFileFormat.EnableVsync;
 | 
			
		||||
            Graphics.EnableShaderCache.Value = configurationFileFormat.EnableShaderCache;
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,7 @@ namespace Ryujinx.UI.Common.Helper
 | 
			
		||||
        public static string[] Arguments { get; private set; }
 | 
			
		||||
 | 
			
		||||
        public static bool? OverrideDockedMode { get; private set; }
 | 
			
		||||
        public static bool? OverrideHardwareAcceleration { get; private set; }
 | 
			
		||||
        public static string OverrideGraphicsBackend { get; private set; }
 | 
			
		||||
        public static string OverrideHideCursor { get; private set; }
 | 
			
		||||
        public static string BaseDirPathArg { get; private set; }
 | 
			
		||||
@@ -87,6 +88,12 @@ namespace Ryujinx.UI.Common.Helper
 | 
			
		||||
 | 
			
		||||
                        OverrideHideCursor = args[++i];
 | 
			
		||||
                        break;
 | 
			
		||||
                    case "--software-gui":
 | 
			
		||||
                        OverrideHardwareAcceleration = false;
 | 
			
		||||
                        break;
 | 
			
		||||
                    case "--hardware-gui":
 | 
			
		||||
                        OverrideHardwareAcceleration = true;
 | 
			
		||||
                        break;
 | 
			
		||||
                    default:
 | 
			
		||||
                        LaunchPathArg = arg;
 | 
			
		||||
                        break;
 | 
			
		||||
 
 | 
			
		||||
@@ -60,12 +60,16 @@ namespace Ryujinx.Ava
 | 
			
		||||
                    EnableMultiTouch = true,
 | 
			
		||||
                    EnableIme = true,
 | 
			
		||||
                    EnableInputFocusProxy = Environment.GetEnvironmentVariable("XDG_CURRENT_DESKTOP") == "gamescope",
 | 
			
		||||
                    RenderingMode = new[] { X11RenderingMode.Glx, X11RenderingMode.Software },
 | 
			
		||||
                    RenderingMode = ConfigurationState.Instance.EnableHardwareAcceleration ?
 | 
			
		||||
                        new[] { X11RenderingMode.Glx, X11RenderingMode.Software } :
 | 
			
		||||
                        new[] { X11RenderingMode.Software },
 | 
			
		||||
                })
 | 
			
		||||
                .With(new Win32PlatformOptions
 | 
			
		||||
                {
 | 
			
		||||
                    WinUICompositionBackdropCornerRadius = 8.0f,
 | 
			
		||||
                    RenderingMode = new[] { Win32RenderingMode.AngleEgl, Win32RenderingMode.Software },
 | 
			
		||||
                    RenderingMode = ConfigurationState.Instance.EnableHardwareAcceleration ?
 | 
			
		||||
                        new[] { Win32RenderingMode.AngleEgl, Win32RenderingMode.Software } :
 | 
			
		||||
                        new[] { Win32RenderingMode.Software },
 | 
			
		||||
                })
 | 
			
		||||
                .UseSkia();
 | 
			
		||||
        }
 | 
			
		||||
@@ -191,6 +195,12 @@ namespace Ryujinx.Ava
 | 
			
		||||
                    _ => ConfigurationState.Instance.HideCursor.Value,
 | 
			
		||||
                };
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Check if hardware-acceleration was overridden.
 | 
			
		||||
            if (CommandLineState.OverrideHardwareAcceleration != null)
 | 
			
		||||
            {
 | 
			
		||||
                ConfigurationState.Instance.EnableHardwareAcceleration.Value = CommandLineState.OverrideHardwareAcceleration.Value;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static void PrintSystemInfo()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user