From 5acfa7d3d6d3ceddf0a3907de6167d0b41ed4809 Mon Sep 17 00:00:00 2001 From: scribam Date: Thu, 29 Dec 2022 18:41:48 +0100 Subject: [PATCH] vulkan: return an error if no physical devices found --- core/rend/vulkan/vulkan_context.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/rend/vulkan/vulkan_context.cpp b/core/rend/vulkan/vulkan_context.cpp index 9937c180f..6d75e3853 100644 --- a/core/rend/vulkan/vulkan_context.cpp +++ b/core/rend/vulkan/vulkan_context.cpp @@ -190,9 +190,15 @@ bool VulkanContext::InitInstance(const char** extensions, uint32_t extensions_co #endif #endif + const auto devices = instance->enumeratePhysicalDevices(); + if (devices.empty()) + { + ERROR_LOG(RENDERER, "Vulkan error: no physical devices found"); + return false; + } + // Choose a discrete gpu if there's one, otherwise just pick the first one physicalDevice = nullptr; - const auto devices = instance->enumeratePhysicalDevices(); for (const auto& phyDev : devices) { vk::PhysicalDeviceProperties props;