Skip to content

Commit

Permalink
- improve error handling during vulkan initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
dpjudas authored and madame-rachelle committed Apr 10, 2019
1 parent 7d1f067 commit 829c8fa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/rendering/vulkan/system/vk_device.cpp
Expand Up @@ -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++)
{
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 829c8fa

Please sign in to comment.