Check for no Vulkan physical devices

Due to broken drivers, it's possible to find no Vulkan physical devices but this can lead to a cryptic segfault. This explicitly checks for it instead and throws an exception which will be emitted into logcat thus can be easily caught.
This commit is contained in:
PixelyIon 2023-01-11 23:38:37 +05:30
parent f882b613bc
commit 45d0558d00

View File

@ -213,7 +213,10 @@ namespace skyline::gpu {
}
static vk::raii::PhysicalDevice CreatePhysicalDevice(const vk::raii::Instance &instance) {
return std::move(vk::raii::PhysicalDevices(instance).front()); // We just select the first device as we aren't expecting multiple GPUs
auto devices{vk::raii::PhysicalDevices(instance)};
if (devices.empty())
throw exception("No Vulkan physical devices found");
return std::move(devices.front()); // We just select the first device as we aren't expecting multiple GPUs
}
static vk::raii::Device CreateDevice(const vk::raii::Context &context,