From ac66643346df76561ff85be741e2998290d43646 Mon Sep 17 00:00:00 2001
From: jhorv <38920027+jhorv@users.noreply.github.com>
Date: Sun, 21 May 2023 15:39:06 -0400
Subject: 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
---
src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
(limited to 'src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs')
diff --git a/src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs b/src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs
index ffa1a103..74267325 100644
--- a/src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs
+++ b/src/Ryujinx.Graphics.Vulkan/VulkanRenderer.cs
@@ -599,6 +599,25 @@ namespace Ryujinx.Graphics.Vulkan
return new HardwareInfo(GpuVendor, GpuRenderer);
}
+ ///
+ /// Gets the available Vulkan devices using the default Vulkan API
+ /// object returned by
+ ///
+ ///
+ 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();
+ }
+ }
+
public static DeviceInfo[] GetPhysicalDevices(Vk api)
{
try
--
cgit v1.2.3