36. Private Data
The private data extension provides a way for users to associate arbitrary user defined data with Vulkan objects. This association is accomplished by storing 64-bit unsigned integers of user defined data in private data slots. A private data slot represents a storage allocation for one data item for each child object of the device.
An application can reserve private data slots at device creation.
To reserve private data slots, insert a VkDevicePrivateDataCreateInfo
in the pNext
chain in VkDeviceCreateInfo before device creation.
Multiple VkDevicePrivateDataCreateInfo structures can be chained
together, and the sum of the requested slots will be reserved.
This is an exception to the specified valid usage for
structure pointer chains.
Reserving slots in this manner is not strictly necessary but it may improve
performance.
To create a private data slot, call:
or the equivalent command
-
device
is the logical device associated with the creation of the object(s) holding the private data slot. -
pAllocator
controls host memory allocation as described in the Memory Allocation chapter. -
pPrivateDataSlot
is a pointer to a VkPrivateDataSlot handle in which the resulting private data slot is returned
The VkPrivateDataSlotCreateInfo
structure is defined as:
or the equivalent
// Provided by VK_EXT_private_data
typedef VkPrivateDataSlotCreateInfo VkPrivateDataSlotCreateInfoEXT;
-
sType
is a VkStructureType value identifying this structure. -
pNext
isNULL
or a pointer to a structure extending this structure.
// Provided by VK_VERSION_1_3
typedef VkFlags VkPrivateDataSlotCreateFlags;
or the equivalent
// Provided by VK_EXT_private_data
typedef VkPrivateDataSlotCreateFlags VkPrivateDataSlotCreateFlagsEXT;
VkPrivateDataSlotCreateFlags
is a bitmask type for setting a mask, but
is currently reserved for future use.
To destroy a private data slot, call:
or the equivalent command
-
device
is the logical device associated with the creation of the object(s) holding the private data slot. -
pAllocator
controls host memory allocation as described in the Memory Allocation chapter.
To store user defined data in a slot associated with a Vulkan object, call:
or the equivalent command
-
objectType
is a VkObjectType specifying the type of object to associate data with. -
objectHandle
is a handle to the object to associate data with. -
privateDataSlot
is a handle to a VkPrivateDataSlot specifying location of private data storage. -
data
is user defined data to associate the object with. This data will be stored atprivateDataSlot
.
To retrieve user defined data from a slot associated with a Vulkan object, call:
or the equivalent command
-
objectType
is a VkObjectType specifying the type of object data is associated with. -
objectHandle
is a handle to the object data is associated with. -
privateDataSlot
is a handle to a VkPrivateDataSlot specifying location of private data pointer storage. -
pData
is a pointer to specify where user data is returned.0
will be written in the absence of a previous call tovkSetPrivateData
using the object specified byobjectHandle
.
Note
Due to platform details on Android, implementations might not be able to
reliably return |