NV Internal Handles
This extension provides a mechanism for applications to obtain opaque internal driver handles for certain Vulkan objects.
Layers may intercept the commands defined by this extension.
An interceptor must not return a wrapped handle to the application.
The returned VkInternalHandleNV value refers directly to the
implementation’s internal object representation.
No special flags or creation requirements are needed to obtain internal handles. Any object of a supported type can be queried. Obtaining an internal handle does not affect the object’s state or usability through the Vulkan API.
An object’s internal handle can be obtained multiple times. Each call returns the same handle.
If an object’s state changes after its internal handle is obtained, the handle continues to refer to the same underlying driver object, subject to the same synchronization requirements.
VkInternalHandleNV represents an opaque internal driver handle for
a Vulkan object, as returned by vkGetPhysicalDeviceInternalHandleNV,
vkGetDeviceInternalHandleNV, vkGetQueueInternalHandleNV, or
vkGetCommandBufferInternalHandleNV:
// Provided by VK_NV_internal_handle
typedef struct VkInternalObjectNV* VkInternalHandleNV;
VkInternalHandleNV is defined as a pointer to an incomplete
VkInternalObjectNV structure.
The contents and layout of the memory referenced by these handles are
implementation-defined.
Applications must not interpret or dereference these handles.
This extension defines no Vulkan interface that consumes them.
An application must only pass them to external APIs that accept them.
The operations performed by those external APIs are outside the scope of
this Specification.
The internal handle returned for a valid object is never NULL.
Each returned internal handle remains valid for the lifetime of its corresponding Vulkan object:
-
Internal handles for a
VkPhysicalDeviceremain valid until theVkInstanceused to enumerate that physical device is destroyed. -
Internal handles for a
VkDeviceremain valid until that device is destroyed. -
Internal handles for a
VkQueueremain valid until theVkDevicethat owns the queue is destroyed. -
Internal handles for a
VkCommandBufferremain valid until that command buffer is freed. This includes freeing the command buffer explicitly with vkFreeCommandBuffers and freeing it implicitly when its command pool is destroyed.
All synchronization requirements that apply to the original Vulkan handles also apply when accessing objects through the corresponding internal handles. Specifically, the application must externally synchronize access to an object between the Vulkan API and any external API using its internal handle.
To obtain an internal handle for a physical device, call:
// Provided by VK_NV_internal_handle
void vkGetPhysicalDeviceInternalHandleNV(
VkPhysicalDevice physicalDevice,
VkInternalHandleNV* pHandle);
-
physicalDeviceis the physical device to query. -
pHandleis a pointer to aVkInternalHandleNVvalue in which the internal handle is returned.
To obtain an internal handle for a logical device, call:
// Provided by VK_NV_internal_handle
void vkGetDeviceInternalHandleNV(
VkDevice device,
VkInternalHandleNV* pHandle);
-
deviceis the logical device to query. -
pHandleis a pointer to aVkInternalHandleNVvalue in which the internal handle is returned.
To obtain an internal handle for a queue, call:
// Provided by VK_NV_internal_handle
void vkGetQueueInternalHandleNV(
VkQueue queue,
VkInternalHandleNV* pHandle);
-
queueis the queue to query. -
pHandleis a pointer to aVkInternalHandleNVvalue in which the internal handle is returned.
To obtain an internal handle for a command buffer, call:
// Provided by VK_NV_internal_handle
void vkGetCommandBufferInternalHandleNV(
VkCommandBuffer commandBuffer,
VkInternalHandleNV* pHandle);
-
commandBufferis the command buffer to query. -
pHandleis a pointer to aVkInternalHandleNVvalue in which the internal handle is returned.
Both primary and secondary command buffers can be queried. A command buffer can be queried in any state, including:
-
The initial state (after allocation or reset)
-
The recording state (between vkBeginCommandBuffer and vkEndCommandBuffer)
-
The executable state (after recording has completed)
-
The pending state (after submission)