summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Halase <jordan@halase.me>2019-10-28 17:07:40 -0500
committerJordan Halase <jordan@halase.me>2019-10-28 17:07:40 -0500
commitdba677e88b302b679582ff50b9c492cce9b501e2 (patch)
treeba8e793dcbb466e421bcb84afa0ba98ee5dfc5cd
parentb7bfbfe3216bb9aacd6df19f117fff8192ba18d5 (diff)
Check if no suitable devices were found
-rw-r--r--main.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/main.c b/main.c
index 5bdedf3..4af8e19 100644
--- a/main.c
+++ b/main.c
@@ -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);
}