Fix crash in SettingsViewModel when Vulkan isn't available (#4985)

* fix crash when Vulkan isn't available

* add VulkanRenderer.GetPhysicalDevices() overload that provides its own Vk API object and logs on failure

* adjustments per AcK77
This commit is contained in:
jhorv 2023-05-21 15:39:06 -04:00 committed by GitHub
parent 21e88f17f6
commit ac66643346
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

View file

@ -599,6 +599,25 @@ namespace Ryujinx.Graphics.Vulkan
return new HardwareInfo(GpuVendor, GpuRenderer);
}
/// <summary>
/// Gets the available Vulkan devices using the default Vulkan API
/// object returned by <see cref="Vk.GetApi()"/>
/// </summary>
/// <returns></returns>
public static DeviceInfo[] GetPhysicalDevices()
{
try
{
return VulkanInitialization.GetSuitablePhysicalDevices(Vk.GetApi());
}
catch (Exception ex)
{
Logger.Error?.PrintMsg(LogClass.Gpu, $"Error querying Vulkan devices: {ex.Message}");
return Array.Empty<DeviceInfo>();
}
}
public static DeviceInfo[] GetPhysicalDevices(Vk api)
{
try