Descriptor Buffers

If the descriptorBuffer feature is enabled, an alternative way to specify descriptor sets is via buffers, rather than descriptor set objects.

Putting Descriptors in Memory

Commands are provided to retrieve descriptor data, and also to locate where in memory that data must be written to match the given descriptor set layout.

vkGetDescriptorSetLayoutSizeEXTGet the size of a descriptor set layout in memory
vkGetDescriptorSetLayoutBindingOffsetEXTGet the offset of a binding within a descriptor set layout
vkGetDescriptorEXTTo get a descriptor to place in a buffer
VkDescriptorGetInfoEXTStructure specifying parameters of descriptor to get
VkDescriptorDataEXTStructure specifying descriptor data
VkDescriptorAddressInfoEXTStructure specifying descriptor buffer address info

Immutable samplers specified in a descriptor set layout through pImmutableSamplers must be provided by applications when obtaining descriptor data. Immutable samplers written in a descriptor buffer must have identical parameters to the immutable samplers in the descriptor set layout that consumes the sampler.

If the descriptor set layout was created with VK_DESCRIPTOR_SET_LAYOUT_CREATE_EMBEDDED_IMMUTABLE_SAMPLERS_BIT_EXT, there is no buffer backing for the immutable sampler, so this requirement does not exist. The implementation handles allocation of these descriptors internally.
As descriptors are now in regular memory, drivers cannot hide copies of immutable samplers that end up in descriptor sets from the application. As such, applications are required to provide these samplers as if they were not provided immutably.
VkDescriptorGetTensorInfoARMStructure specifying parameters to get descriptor data for tensor views

Binding Descriptor Buffers

Descriptor buffers have their own separate binding point on the command buffer, with buffers bound using vkCmdBindDescriptorBuffersEXT. vkCmdSetDescriptorBufferOffsetsEXT assigns pairs of buffer binding indices and buffer offsets to the same binding point on the command buffer as vkCmdBindDescriptorSets, allowing subsequent bound pipeline commands to use the specified descriptor buffers. Bindings applied via vkCmdBindDescriptorSets cannot exist simultaneously with those applied via calls to vkCmdSetDescriptorBufferOffsetsEXT or vkCmdBindDescriptorBufferEmbeddedSamplersEXT, as calls to vkCmdSetDescriptorBufferOffsetsEXT or vkCmdBindDescriptorBufferEmbeddedSamplersEXT invalidate any bindings by previous calls to vkCmdBindDescriptorSets and vice-versa.

vkCmdBindDescriptorBuffersEXTBinding descriptor buffers to a command buffer
VkDescriptorBufferBindingInfoEXTStructure specifying descriptor buffer binding information
VkDescriptorBufferBindingPushDescriptorBufferHandleEXTStructure specifying push descriptor buffer binding information
vkCmdSetDescriptorBufferOffsetsEXTSetting descriptor buffer offsets in a command buffer
vkCmdSetDescriptorBufferOffsets2EXTSetting descriptor buffer offsets in a command buffer
VkSetDescriptorBufferOffsetsInfoEXTStructure specifying descriptor buffer offsets to set in a command buffer
vkCmdBindDescriptorBufferEmbeddedSamplersEXTSetting embedded immutable samplers offsets in a command buffer
vkCmdBindDescriptorBufferEmbeddedSamplers2EXTSetting embedded immutable samplers offsets in a command buffer
VkBindDescriptorBufferEmbeddedSamplersInfoEXTStructure specifying embedded immutable sampler offsets to set in a command buffer

Updating Descriptor Buffers

Updates to descriptor data in buffers can be performed by any operation on either the host or device that can access memory.

Descriptor buffer reads can be synchronized using VK_ACCESS_2_DESCRIPTOR_BUFFER_READ_BIT_EXT in the relevant shader stage.

Push Descriptors With Descriptor Buffers

If the descriptorBufferPushDescriptors feature is enabled, push descriptors can be used with descriptor buffers in the same way as with descriptor sets.

The VkPhysicalDeviceDescriptorBufferPropertiesEXT::bufferlessPushDescriptors property indicates whether the implementation requires a buffer to back push descriptors. If the property is VK_FALSE then before recording any push descriptors, the application must bind exactly 1 descriptor buffer that was created with the VK_BUFFER_USAGE_PUSH_DESCRIPTORS_DESCRIPTOR_BUFFER_BIT_EXT usage flag set. When this buffer is bound, any previously recorded push descriptors that are required for a subsequent command must be recorded again.

Capture and Replay

In a similar way to bufferDeviceAddressCaptureReplay, the descriptorBufferCaptureReplay feature allows the creation of opaque handles for objects at capture time that can be passed into object creation calls in a future replay, causing descriptors to be created with the same data. The opaque memory address for any memory used by these resources must have been captured using vkGetDeviceMemoryOpaqueCaptureAddress and be replayed using VkMemoryOpaqueCaptureAddressAllocateInfo.

vkGetBufferOpaqueCaptureDescriptorDataEXTGet buffer opaque capture descriptor data
VkBufferCaptureDescriptorDataInfoEXTStructure specifying a buffer for descriptor capture
vkGetImageOpaqueCaptureDescriptorDataEXTGet image opaque capture descriptor data
VkImageCaptureDescriptorDataInfoEXTStructure specifying an image for descriptor capture
vkGetImageViewOpaqueCaptureDescriptorDataEXTGet image view opaque capture descriptor data
VkImageViewCaptureDescriptorDataInfoEXTStructure specifying an image view for descriptor capture
vkGetSamplerOpaqueCaptureDescriptorDataEXTGet sampler opaque capture descriptor data
VkSamplerCaptureDescriptorDataInfoEXTStructure specifying a sampler for descriptor capture
vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXTGet acceleration structure opaque capture descriptor data
VkAccelerationStructureCaptureDescriptorDataInfoEXTStructure specifying an acceleration structure for descriptor capture
VkOpaqueCaptureDescriptorDataCreateInfoEXTStructure specifying opaque capture descriptor data
vkGetTensorOpaqueCaptureDescriptorDataARMGet tensor opaque capture descriptor data
VkTensorCaptureDescriptorDataInfoARMStructure specifying a tensor for descriptor capture
vkGetTensorViewOpaqueCaptureDescriptorDataARMGet tensor view opaque capture descriptor data
VkTensorViewCaptureDescriptorDataInfoARMStructure specifying a tensor view for descriptor capture