diff options
author | Jordan Halase <jordan@halase.me> | 2019-10-28 17:07:40 -0500 |
---|---|---|
committer | Jordan Halase <jordan@halase.me> | 2019-10-28 17:07:40 -0500 |
commit | dba677e88b302b679582ff50b9c492cce9b501e2 (patch) | |
tree | ba8e793dcbb466e421bcb84afa0ba98ee5dfc5cd | |
parent | b7bfbfe3216bb9aacd6df19f117fff8192ba18d5 (diff) |
Check if no suitable devices were found
-rw-r--r-- | main.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -507,21 +507,25 @@ void selectPhysicalDevice(struct RenderVulkan *vk) } } - for (uint32_t i = 0; i < nDevices; ++i) { + uint32_t i; + for (i = 0; i < nDevices; ++i) { VkPhysicalDeviceProperties deviceProperties; vk->api->vkGetPhysicalDeviceProperties(devices[i], &deviceProperties); printf("Found physical device:\t`%s`\n", deviceProperties.deviceName); } - for (uint32_t i = 0; i < nDevices; ++i) { + for (i = 0; i < nDevices; ++i) { VkPhysicalDeviceProperties deviceProperties; vk->api->vkGetPhysicalDeviceProperties(devices[i], &deviceProperties); printf("Checking suitability for `%s`...\n", deviceProperties.deviceName); if (isDeviceSuitable(vk, devices[i])) { printf("Using physical device:\t`%s`\n", deviceProperties.deviceName); - break; + goto done; } printf("Device `%s` not suitable\n", deviceProperties.deviceName); } + if (i >= nDevices) { + setErrMsg(vk, "No suitable devices found"); + } done: free(devices); } |