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;
const char *prio_strs[3] = {
"realtime",
"high",
"normal",
"QUEUE_GLOBAL_PRIORITY_REALTIME",
"QUEUE_GLOBAL_PRIORITY_HIGH",
"QUEUE_GLOBAL_PRIORITY_MEDIUM",
};
VkQueueGlobalPriorityEXT prios[3] = {
@ -243,8 +243,8 @@ create_device(struct vk_bundle *vk, const struct comp_vulkan_arguments *vk_args)
// All ok!
if (ret == VK_SUCCESS) {
VK_INFO(vk, "Created device and %s queue with %s priority.",
only_compute_queue ? "compute" : "graphics", prio_strs[i]);
VK_INFO(vk, "Created device and %s queue with %s.", only_compute_queue ? "COMPUTE" : "GRAPHICS",
prio_strs[i]);
break;
}
@ -258,6 +258,12 @@ create_device(struct vk_bundle *vk, const struct comp_vulkan_arguments *vk_args)
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);
if (ret != VK_SUCCESS) {
VK_ERROR_RET(vk, "vk_init_mutex", "Failed to init mutex.", ret);