45. External Compute Queues
External compute queues are used to join compatible external APIs to a
VkDevice, allowing workloads submitted through these external APIs to
be executed simultaneously to workloads submitted through Vulkan.
External compute queues are represented by VkExternalComputeQueueNV
handles:
// Provided by VK_NV_external_compute_queue
VK_DEFINE_HANDLE(VkExternalComputeQueueNV)
To create an external compute queue for use by compatible external APIs call:
// Provided by VK_NV_external_compute_queue
VkResult vkCreateExternalComputeQueueNV(
VkDevice device,
const VkExternalComputeQueueCreateInfoNV* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkExternalComputeQueueNV* pExternalQueue);
-
deviceis the VkDevice that the external queue will be a part of. -
pCreateInfois a pointer to a VkExternalComputeQueueCreateInfoNV structure specifying configuration info for creating the external queue. -
pAllocatorcontrols host memory allocation as described in the Memory Allocation chapter. -
pExternalQueueis a pointer to a VkExternalComputeQueueNV object that will be filled with the handle for the created external queue.
To destroy a previously created external compute queue call:
// Provided by VK_NV_external_compute_queue
void vkDestroyExternalComputeQueueNV(
VkDevice device,
VkExternalComputeQueueNV externalQueue,
const VkAllocationCallbacks* pAllocator);
-
deviceis the logical device that destroys the external queue. -
externalQueueis the VkExternalComputeQueueNV to destroy. -
pAllocatorcontrols host memory allocation as described in the Memory Allocation chapter.
To query the implementation-specific data that must be passed to compatible external APIs during their initialization process call:
// Provided by VK_NV_external_compute_queue
void vkGetExternalComputeQueueDataNV(
VkExternalComputeQueueNV externalQueue,
VkExternalComputeQueueDataParamsNV* params,
void* pData);
-
externalQueueis the VkExternalComputeQueueNV to query the data for. -
paramsis a pointer to a VkExternalComputeQueueDataParamsNV structure specifying parameters required for retrieval of the implementation-specific data. -
pDatais a pointer to application-allocated memory in which the requested data will be returned.
The VkExternalComputeQueueDeviceCreateInfoNV structure is defined as:
// Provided by VK_NV_external_compute_queue
typedef struct VkExternalComputeQueueDeviceCreateInfoNV {
VkStructureType sType;
const void* pNext;
uint32_t reservedExternalQueues;
} VkExternalComputeQueueDeviceCreateInfoNV;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
reservedExternalQueuesis the maximum number of external queues an application can create at once. This must be less than or equal to themaxExternalQueuesvalue reported by VkPhysicalDeviceExternalComputeQueuePropertiesNV
The VkExternalComputeQueueCreateInfoNV structure is defined as:
// Provided by VK_NV_external_compute_queue
typedef struct VkExternalComputeQueueCreateInfoNV {
VkStructureType sType;
const void* pNext;
VkQueue preferredQueue;
} VkExternalComputeQueueCreateInfoNV;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
preferredQueueis aVkQueuesupporting graphics commands.
When creating a VkExternalComputeQueueNV, the preferredQueue
field is a strong scheduling hint as to which VkQueue Vulkan graphics
workloads will be submitted to with the expectation that execution will
overlap with execution of work submitted by the external API.
The VkExternalComputeQueueDataParamsNV structure is defined as:
// Provided by VK_NV_external_compute_queue
typedef struct VkExternalComputeQueueDataParamsNV {
VkStructureType sType;
const void* pNext;
uint32_t deviceIndex;
} VkExternalComputeQueueDataParamsNV;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
deviceIndexis the index of the device within a device group that the data is being queried for. This is ignored if device groups are not utilized.
The VkPhysicalDeviceExternalComputeQueuePropertiesNV structure is
defined as:
// Provided by VK_NV_external_compute_queue
typedef struct VkPhysicalDeviceExternalComputeQueuePropertiesNV {
VkStructureType sType;
void* pNext;
uint32_t externalDataSize;
uint32_t maxExternalQueues;
} VkPhysicalDeviceExternalComputeQueuePropertiesNV;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
externalDataSizeis the minimum size of the memory allocation that applications can pass to vkGetExternalComputeQueueDataNV. -
maxExternalQueuesis the maximum number of external queues that an application can create.