跳转至

vkGetDeviceQueue

函数原型

1
2
3
4
5
void vkGetDeviceQueue(
    VkDevice                                    device,
    uint32_t                                    queueFamilyIndex,
    uint32_t                                    queueIndex,
    VkQueue*                                    pQueue);

描述

从逻辑设备获取队列。

Note

vkGetDeviceQueue 只能用于获取使用 VkDeviceQueueCreateInfo.flags = 0 参数创建的队列。获取使用非零标志创建的队列需使用 vkGetDeviceQueue2

参数

  • device : 包含队列的逻辑设备。
  • queueFamilyIndex : 队列所属队列簇的索引。
  • queueIndex : 要获取的队列在该队列簇中的索引。
  • pQueue : 获取的 VkQueue 队列对象的指针。

返回值

代码示例

1
2
3
4
5
6
7
VkQueue GetDeviceQueue(uint32_t graphicsQueueIndex)
{
    VkQueue queue = VK_NULL_HANDLE;
    VkDevice device = CreateDevice();
    vkGetDeviceQueue(device, graphicsQueueIndex, 0, &queue);
    return queue;
}