- improve error handling during vulkan initialization

This commit is contained in:
Magnus Norddahl 2019-04-09 12:28:25 +02:00
parent 536aa98e87
commit d3dacfc2cb

View file

@ -112,6 +112,8 @@ bool VulkanDevice::CheckRequiredFeatures(const VkPhysicalDeviceFeatures &f)
void VulkanDevice::SelectPhysicalDevice()
{
AvailableDevices = GetPhysicalDevices(instance);
if (AvailableDevices.empty())
I_Error("No Vulkan devices found. Either the graphics card has no vulkan support or the driver is too old.");
for (size_t idx = 0; idx < AvailableDevices.size(); idx++)
{
@ -426,6 +428,8 @@ std::vector<VulkanPhysicalDevice> VulkanDevice::GetPhysicalDevices(VkInstance in
{
uint32_t deviceCount = 0;
VkResult result = vkEnumeratePhysicalDevices(instance, &deviceCount, nullptr);
if (result != VK_ERROR_INITIALIZATION_FAILED) // Some drivers return this when a card does not support vulkan
return {};
if (result != VK_SUCCESS)
I_Error("vkEnumeratePhysicalDevices failed");
if (deviceCount == 0)