summaryrefslogtreecommitdiff
path: root/render/vulkan/device.c
diff options
context:
space:
mode:
authorDanny Holman <dholman@gymli.org>2024-10-28 15:58:23 -0500
committerDanny Holman <dholman@gymli.org>2024-10-28 15:58:23 -0500
commit6709e300385c610f14b848961c2c5afdbc9aadc0 (patch)
tree8e0588296d59f044eafcbe33519842147a014512 /render/vulkan/device.c
parent2965bdde04eaa0012b29695aa015c354deb30bed (diff)
render: error check when creating device queues
When creating Vulkan device queues, the returned queue objects should be check for NULL values. If any queue is invalid, the process must be aborted. Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'render/vulkan/device.c')
-rw-r--r--render/vulkan/device.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/render/vulkan/device.c b/render/vulkan/device.c
index 3aef3a1..a123983 100644
--- a/render/vulkan/device.c
+++ b/render/vulkan/device.c
@@ -143,9 +143,25 @@ struct vkdev* create_vkdev(VkInstance instance, VkSurfaceKHR surface) {
vkassert(vkCreateDevice(dev->pdev, &dcinfo, NULL, &dev->ldev));
vkGetDeviceQueue(dev->ldev, dev->gfx_index, 0, &dev->gfx_queue);
+ if (dev->gfx_queue == NULL) {
+ log_output(LOG_FATAL, "Error creating Vulkan graphics queue");
+ rune_abort();
+ }
vkGetDeviceQueue(dev->ldev, dev->tsfr_index, 0, &dev->tsfr_queue);
+ if (dev->tsfr_queue == NULL) {
+ log_output(LOG_FATAL, "Error creating Vulkan transfer queue");
+ rune_abort();
+ }
vkGetDeviceQueue(dev->ldev, dev->pres_index, 0, &dev->pres_queue);
+ if (dev->pres_queue == NULL) {
+ log_output(LOG_FATAL, "Error creating Vulkan present queue");
+ rune_abort();
+ }
vkGetDeviceQueue(dev->ldev, dev->comp_index, 0, &dev->comp_queue);
+ if (dev->comp_queue == NULL) {
+ log_output(LOG_FATAL, "Error creating Vulkan compute queue");
+ rune_abort();
+ }
VkCommandPoolCreateInfo pcinfo;
pcinfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;