misc: Default to Vulkan if available or running on macOS (#5913)

* Addition of default backend check. Vulkan is preferred if available or macOS.

* import ordering format fix

* Update src/Ryujinx/Program.cs

Co-authored-by: gdkchan <gab.dark.100@gmail.com>

* remove redundant load types

---------

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
This commit is contained in:
MutantAura 2023-11-18 20:42:45 +00:00 committed by GitHub
parent 82a638230e
commit aa96dcb1be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 61 deletions

View file

@ -177,8 +177,6 @@ namespace Ryujinx
? appDataConfigurationPath
: null;
bool showVulkanPrompt = false;
if (ConfigurationPath == null)
{
// No configuration, we load the default values and save it to disk
@ -186,26 +184,17 @@ namespace Ryujinx
ConfigurationState.Instance.LoadDefault();
ConfigurationState.Instance.ToFileFormat().SaveConfig(ConfigurationPath);
showVulkanPrompt = true;
}
else
{
if (ConfigurationFileFormat.TryLoad(ConfigurationPath, out ConfigurationFileFormat configurationFileFormat))
{
ConfigurationLoadResult result = ConfigurationState.Instance.Load(configurationFileFormat, ConfigurationPath);
if ((result & ConfigurationLoadResult.MigratedFromPreVulkan) != 0)
{
showVulkanPrompt = true;
}
ConfigurationState.Instance.Load(configurationFileFormat, ConfigurationPath);
}
else
{
ConfigurationState.Instance.LoadDefault();
showVulkanPrompt = true;
Logger.Warning?.PrintMsg(LogClass.Application, $"Failed to load config! Loading the default config instead.\nFailed config location {ConfigurationPath}");
}
}
@ -216,12 +205,10 @@ namespace Ryujinx
if (CommandLineState.OverrideGraphicsBackend.ToLower() == "opengl")
{
ConfigurationState.Instance.Graphics.GraphicsBackend.Value = GraphicsBackend.OpenGl;
showVulkanPrompt = false;
}
else if (CommandLineState.OverrideGraphicsBackend.ToLower() == "vulkan")
{
ConfigurationState.Instance.Graphics.GraphicsBackend.Value = GraphicsBackend.Vulkan;
showVulkanPrompt = false;
}
}
@ -343,35 +330,6 @@ namespace Ryujinx
}, TaskContinuationOptions.OnlyOnFaulted);
}
if (showVulkanPrompt)
{
var buttonTexts = new Dictionary<int, string>()
{
{ 0, "Yes (Vulkan)" },
{ 1, "No (OpenGL)" },
};
ResponseType response = GtkDialog.CreateCustomDialog(
"Ryujinx - Default graphics backend",
"Use Vulkan as default graphics backend?",
"Ryujinx now supports the Vulkan API. " +
"Vulkan greatly improves shader compilation performance, " +
"and fixes some graphical glitches; however, since it is a new feature, " +
"you may experience some issues that did not occur with OpenGL.\n\n" +
"Note that you will also lose any existing shader cache the first time you start a game " +
"on version 1.1.200 onwards, because Vulkan required changes to the shader cache that makes it incompatible with previous versions.\n\n" +
"Would you like to set Vulkan as the default graphics backend? " +
"You can change this at any time on the settings window.",
buttonTexts,
MessageType.Question);
ConfigurationState.Instance.Graphics.GraphicsBackend.Value = response == 0
? GraphicsBackend.Vulkan
: GraphicsBackend.OpenGl;
ConfigurationState.Instance.ToFileFormat().SaveConfig(ConfigurationPath);
}
Application.Run();
}