Don't abort if Vulkan is not available

This commit is contained in:
Patrick Nicolas
2026-02-16 21:54:48 +01:00
parent 6b9e1e108c
commit a94edf52e2
3 changed files with 17 additions and 9 deletions
+1 -1
View File
@@ -193,7 +193,7 @@ Kirigami.ApplicationWindow {
text: Settings.flatpak ? i18n("Vulkan drivers cannot be found, you may need to run \"flatpak update\"") : i18n("Vulkan drivers cannot be found") text: Settings.flatpak ? i18n("Vulkan drivers cannot be found, you may need to run \"flatpak update\"") : i18n("Vulkan drivers cannot be found")
type: Kirigami.MessageType.Warning type: Kirigami.MessageType.Warning
showCloseButton: true showCloseButton: true
visible: DashboardSettings.show_system_checks && VulkanInfo.type == VulkanInfo.SoftGPU visible: DashboardSettings.show_system_checks && (VulkanInfo.type == VulkanInfo.SoftGPU || VulkanInfo.type == VulkanInfo.NoGPU)
} }
Kirigami.InlineMessage { Kirigami.InlineMessage {
+13 -6
View File
@@ -24,14 +24,21 @@
vulkan_info::vulkan_info() vulkan_info::vulkan_info()
{ {
vk::raii::Context context; try
{
vk::raii::Context context;
vk::ApplicationInfo app_info{"WiVRn dashboard", 1, "No engine", 1, VK_API_VERSION_1_1}; vk::ApplicationInfo app_info{"WiVRn dashboard", 1, "No engine", 1, VK_API_VERSION_1_1};
vk::InstanceCreateInfo instance_info{vk::InstanceCreateFlags{0}, &app_info}; vk::InstanceCreateInfo instance_info{vk::InstanceCreateFlags{0}, &app_info};
vk::raii::Instance vulkan{context, instance_info}; vk::raii::Instance vulkan{context, instance_info};
auto devices = vulkan.enumeratePhysicalDevices(); auto devices = vulkan.enumeratePhysicalDevices();
set_info(choose_device(devices)); set_info(choose_device(devices));
}
catch (std::runtime_error & e)
{
qCritical() << "Failed to get vulkan info: " << e.what();
}
} }
static vulkan_info::gpu_type cast_type(vk::PhysicalDeviceType type) static vulkan_info::gpu_type cast_type(vk::PhysicalDeviceType type)
+3 -2
View File
@@ -41,6 +41,7 @@ public:
SoftGPU, SoftGPU,
VirtGPU, VirtGPU,
OtherGPU, OtherGPU,
NoGPU,
}; };
Q_ENUM(gpu_type) Q_ENUM(gpu_type)
@@ -51,8 +52,8 @@ public:
QString m_driverId; QString m_driverId;
QString m_driverVersion; QString m_driverVersion;
uint32_t m_driverVersionCode; uint32_t m_driverVersionCode{};
gpu_type m_type; gpu_type m_type = NoGPU;
vk::raii::PhysicalDevice & choose_device(std::vector<vk::raii::PhysicalDevice> & devices); vk::raii::PhysicalDevice & choose_device(std::vector<vk::raii::PhysicalDevice> & devices);
void set_info(vk::raii::PhysicalDevice & device); void set_info(vk::raii::PhysicalDevice & device);