vulkan: return an error if no physical devices found

This commit is contained in:
scribam 2022-12-29 18:41:48 +01:00 committed by flyinghead
parent bfc44f2b4e
commit 5acfa7d3d6
1 changed files with 7 additions and 1 deletions

View File

@ -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;