Monado OpenXR Runtime
vk_queue_builder.h
Go to the documentation of this file.
1// Copyright 2025-2026, NVIDIA CORPORATION.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Vulkan queue builder helper.
6 * @author Jakob Bornecrantz <tbornecrantz@nvidia.com>
7 * @ingroup aux_vk
8 */
9
10#pragma once
11
12#include "vk/vk_helpers.h"
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18
19/*!
20 * A builder for creating a list of queue create infos, allocate on the stack
21 * and then pass into vkCreateDevice.
22 *
23 * @ingroup aux_vk
24 */
26{
27 //! Array of queue create infos to fill in.
28 VkDeviceQueueCreateInfo create_infos[VK_BUNDLE_MAX_QUEUES];
29
30 /*!
31 * Array of queue priorities to fill in. While VK_BUNDLE_MAX_QUEUES is
32 * the maximum total number of queues, there can either be that many
33 * queues from one family, or one queue from each of that many families,
34 * or any combination in between. Since we don't know ahead of time how
35 * many families will be used, we allocate the maximum in each dimension
36 * for simplicity.
37 */
38 float priorities[VK_BUNDLE_MAX_QUEUES][VK_BUNDLE_MAX_QUEUES];
39
40 //! Count of queue create infos and priorities added.
42
43 /*!
44 * Can create multiple queues in the same family, this is the total
45 * number of queues that are created, must be less than or equal to
46 * @ref VK_BUNDLE_MAX_QUEUES.
47 */
48 uint32_t total_count;
49};
50
51/*!
52 * Add a queue to the builder, will assert if it runs out of space, assumes that
53 * the user can share the queue with other users.
54 *
55 * @param builder The builder to add the queue to.
56 * @param family_index The family index of the queue to add.
57 * @return The queue pair of the added queue.
58 */
59struct vk_queue_pair
60vk_queue_builder_add(struct vk_queue_builder *builder, uint32_t family_index);
61
62
63#ifdef __cplusplus
64}
65#endif
A builder for creating a list of queue create infos, allocate on the stack and then pass into vkCreat...
Definition: vk_queue_builder.h:26
uint32_t total_count
Can create multiple queues in the same family, this is the total number of queues that are created,...
Definition: vk_queue_builder.h:48
VkDeviceQueueCreateInfo create_infos[VK_BUNDLE_MAX_QUEUES]
Array of queue create infos to fill in.
Definition: vk_queue_builder.h:28
uint32_t create_info_count
Count of queue create infos and priorities added.
Definition: vk_queue_builder.h:41
float priorities[VK_BUNDLE_MAX_QUEUES][VK_BUNDLE_MAX_QUEUES]
Array of queue priorities to fill in.
Definition: vk_queue_builder.h:38
Definition: vk_helpers.h:42
uint32_t family_index
The queue family index.
Definition: vk_helpers.h:44
Common Vulkan code header.
struct vk_queue_pair vk_queue_builder_add(struct vk_queue_builder *builder, uint32_t family_index)
Add a queue to the builder, will assert if it runs out of space, assumes that the user can share the ...
Definition: vk_queue_builder.c:23