c/util: Slightly improve device and queue creation

This commit is contained in:
Jakob Bornecrantz 2022-11-03 17:50:58 +00:00
parent 3f3e19299f
commit 736f1fd671

View file

@ -211,9 +211,9 @@ create_device(struct vk_bundle *vk, const struct comp_vulkan_arguments *vk_args)
VkResult ret; VkResult ret;
const char *prio_strs[3] = { const char *prio_strs[3] = {
"realtime", "QUEUE_GLOBAL_PRIORITY_REALTIME",
"high", "QUEUE_GLOBAL_PRIORITY_HIGH",
"normal", "QUEUE_GLOBAL_PRIORITY_MEDIUM",
}; };
VkQueueGlobalPriorityEXT prios[3] = { VkQueueGlobalPriorityEXT prios[3] = {
@ -243,8 +243,8 @@ create_device(struct vk_bundle *vk, const struct comp_vulkan_arguments *vk_args)
// All ok! // All ok!
if (ret == VK_SUCCESS) { if (ret == VK_SUCCESS) {
VK_INFO(vk, "Created device and %s queue with %s priority.", VK_INFO(vk, "Created device and %s queue with %s.", only_compute_queue ? "COMPUTE" : "GRAPHICS",
only_compute_queue ? "compute" : "graphics", prio_strs[i]); prio_strs[i]);
break; break;
} }
@ -258,6 +258,12 @@ create_device(struct vk_bundle *vk, const struct comp_vulkan_arguments *vk_args)
return ret; return ret;
} }
// All tries failed, return error. Yes this code is clunky.
if (ret != VK_SUCCESS) {
VK_ERROR_RET(vk, "vk_create_device", "Failed to create Vulkan device.", ret);
return ret;
}
ret = vk_init_mutex(vk); ret = vk_init_mutex(vk);
if (ret != VK_SUCCESS) { if (ret != VK_SUCCESS) {
VK_ERROR_RET(vk, "vk_init_mutex", "Failed to init mutex.", ret); VK_ERROR_RET(vk, "vk_init_mutex", "Failed to init mutex.", ret);