Retrieving the queue object handle
Once the logical device has been created, we need to obtain the handle to queues. That is accomplished with the vkGetDeviceQueue
function. This handle will be used to submit command buffers for processing on the GPU.
In this recipe, you will learn how to obtain the handle to a Vulkan queue.
Getting ready
In the repository, all queues are retrieved and stored by the VulkanCore::Context
class. That class maintains a list for each type of queue: graphics, compute, transfer, and sparse, along with a special queue for presentation.
How to do it…
To retrieve the handle to a queue, just call the vkGetDeviceQueue
function with the queue family index and the queue index:
VkQueue queue{VK_NULL_HANDLE}; uint32_t queueFamilyIndex; // valid queue family vkGetDeviceQueue(device, queueFamilyIndex, 0, &queue);
Knowing which queue families are available is not enough. Once we determine which queues are available and the queues we need...