跳到主要内容

vkGetPhysicalDeviceQueueFamilyProperties

函数原型

void vkGetPhysicalDeviceQueueFamilyProperties(
VkPhysicalDevice physicalDevice,
uint32_t* pQueueFamilyPropertyCount,
VkQueueFamilyProperties* pQueueFamilyProperties);

描述

查询物理设备的队列属性。

参数

  • physicalDevice : 查询的物理设备。

  • pQueueFamilyPropertyCount : 物理设备的队列族数量的指针。

  • pQueueFamilyProperties : NULL或者 VkQueueFamilyProperties 结构体数组指针。

    • pQueueFamilyProperties 为NULL时,pQueueFamilyPropertyCount 返回可用队列族数量;
    • pQueueFamilyProperties 不为NULL时,写入 pQueueFamilyPropertyCount 个队列族属性信息到 pPhysicalDevices中。

补充

VkPhysicalDeviceProperties 结构体定义:

typedef struct VkPhysicalDeviceProperties {
uint32_t apiVersion;
uint32_t driverVersion;
uint32_t vendorID;
uint32_t deviceID;
VkPhysicalDeviceType deviceType;
char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE];
uint8_t pipelineCacheUUID[VK_UUID_SIZE];
VkPhysicalDeviceLimits limits;
VkPhysicalDeviceSparseProperties sparseProperties;
} VkPhysicalDeviceProperties;

返回值

代码示例

// get queue family properties from device 0 
uint32_t queue_family_count = 0;
VkPhysicalDevice physicalDevice = GetPhysicalDevices(0);
vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queue_family_count, NULL);

std::vector<VkQueueFamilyProperties> queue_props;
queue_props.resize(queue_family_count);
vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queue_family_count, queue_props.data());