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.
To determine the amount of memory needed to store all descriptors with a given layout, call:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
void vkGetDescriptorSetLayoutSizeEXT(
VkDevice device,
VkDescriptorSetLayout layout,
VkDeviceSize* pLayoutSizeInBytes);
-
deviceis the logical device that gets the size. -
layoutis the descriptor set layout being queried. -
pLayoutSizeInBytesis a pointer toVkDeviceSizewhere the size in bytes will be written.
The size of a descriptor set layout will be at least as large as the sum total of the size of all descriptors in the layout, and may be larger. This size represents the amount of memory that will be required to store all of the descriptors for this layout in memory, when placed according to the layout’s offsets as obtained by vkGetDescriptorSetLayoutBindingOffsetEXT.
If any binding in layout is
VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT, the returned size
includes space for the maximum descriptorCount descriptors as declared
for that binding.
To compute the required size of a descriptor set with a
VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT:
-
size = offset + descriptorSize × variableDescriptorCount
where offset is obtained by
vkGetDescriptorSetLayoutBindingOffsetEXT and descriptorSize is
the size of the relevant descriptor as obtained from
VkPhysicalDeviceDescriptorBufferPropertiesEXT, and
variableDescriptorCount is the equivalent of
VkDescriptorSetVariableDescriptorCountAllocateInfo::pDescriptorCounts.
For VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK,
variableDescriptorCount is the size in bytes for the inline uniform
block, and descriptorSize is 1.
If
VkPhysicalDeviceDescriptorBufferPropertiesEXT::combinedImageSamplerDescriptorSingleArray
is VK_FALSE and the variable descriptor type is
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
variableDescriptorCount is always considered to be the upper bound.
To get the offset of a binding within a descriptor set layout in memory, call:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
void vkGetDescriptorSetLayoutBindingOffsetEXT(
VkDevice device,
VkDescriptorSetLayout layout,
uint32_t binding,
VkDeviceSize* pOffset);
-
deviceis the logical device that gets the offset. -
layoutis the descriptor set layout being queried. -
bindingis the binding number being queried. -
pOffsetis a pointer toVkDeviceSizewhere the byte offset of the binding will be written.
Each binding in a descriptor set layout is assigned an offset in memory by the implementation. When a shader accesses a resource with that binding, it will access the bound descriptor buffer from that offset to look for its descriptor. This command provides an application with that offset, so that descriptors can be placed in the correct locations. The precise location accessed by a shader for a given descriptor is as follows:
-
location = bufferAddress + setOffset + descriptorOffset + (arrayElement × descriptorSize)
where bufferAddress and setOffset are the base address and
offset for the identified descriptor set as specified by
vkCmdBindDescriptorBuffersEXT and
vkCmdSetDescriptorBufferOffsetsEXT, descriptorOffset is the
offset for the binding returned by this command, arrayElement is the
index into the array specified in the shader, and descriptorSize is
the size of the relevant descriptor as obtained from
VkPhysicalDeviceDescriptorBufferPropertiesEXT.
Applications are responsible for placing valid descriptors at the expected
location in order for a shader to access it.
The overall offset added to bufferAddress to calculate location
must be less than
VkPhysicalDeviceDescriptorBufferPropertiesEXT::maxSamplerDescriptorBufferRange
for samplers and
VkPhysicalDeviceDescriptorBufferPropertiesEXT::maxResourceDescriptorBufferRange
for resources.
If any binding in layout is
VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT, that
binding must have the largest offset of any binding.
A descriptor binding with type VK_DESCRIPTOR_TYPE_MUTABLE_EXT
can be used.
Any potential types in
VkMutableDescriptorTypeCreateInfoEXT::pDescriptorTypes for
binding share the same offset.
If the size of the mutable descriptor is larger
than the size of a concrete descriptor type being accessed, the padding area
is ignored by the implementation.
To get descriptor data to place in a buffer, call:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
void vkGetDescriptorEXT(
VkDevice device,
const VkDescriptorGetInfoEXT* pDescriptorInfo,
size_t dataSize,
void* pDescriptor);
-
deviceis the logical device that gets the descriptor. -
pDescriptorInfois a pointer to a VkDescriptorGetInfoEXT structure specifying the parameters of the descriptor to get. -
dataSizeis the amount of the descriptor data to get in bytes. -
pDescriptoris a pointer to an application-allocated buffer where the descriptor will be written.
The size of the data for each descriptor type is determined by the value in VkPhysicalDeviceDescriptorBufferPropertiesEXT. This value also defines the stride in bytes for arrays of that descriptor type.
If the
VkPhysicalDeviceDescriptorBufferPropertiesEXT::combinedImageSamplerDescriptorSingleArray
property is VK_FALSE the implementation requires an array of
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER descriptors to be written
into a descriptor buffer as an array of image descriptors, immediately
followed by an array of sampler descriptors.
Applications must write the first
VkPhysicalDeviceDescriptorBufferPropertiesEXT::sampledImageDescriptorSize
bytes of the data returned through pDescriptor to the first array, and
the remaining
VkPhysicalDeviceDescriptorBufferPropertiesEXT::samplerDescriptorSize
bytes of the data to the second array.
For variable-sized descriptor bindings of
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER descriptors, the two arrays
each have a size equal to the upper bound descriptorCount of that
binding.
A descriptor obtained by this command references the underlying VkImageView or VkSampler, and these objects must not be destroyed before the last time a descriptor is dynamically accessed. For descriptor types which consume an address instead of an object, the underlying VkBuffer is referenced instead.
Information about the descriptor to get is passed in a
VkDescriptorGetInfoEXT structure:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
typedef struct VkDescriptorGetInfoEXT {
VkStructureType sType;
const void* pNext;
VkDescriptorType type;
VkDescriptorDataEXT data;
} VkDescriptorGetInfoEXT;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
typeis the type of descriptor to get. -
datais a VkDescriptorDataEXT union containing the information needed to get the descriptor.
Data describing the descriptor is passed in a VkDescriptorDataEXT
structure:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
typedef union VkDescriptorDataEXT {
const VkSampler* pSampler;
const VkDescriptorImageInfo* pCombinedImageSampler;
const VkDescriptorImageInfo* pInputAttachmentImage;
const VkDescriptorImageInfo* pSampledImage;
const VkDescriptorImageInfo* pStorageImage;
const VkDescriptorAddressInfoEXT* pUniformTexelBuffer;
const VkDescriptorAddressInfoEXT* pStorageTexelBuffer;
const VkDescriptorAddressInfoEXT* pUniformBuffer;
const VkDescriptorAddressInfoEXT* pStorageBuffer;
VkDeviceAddress accelerationStructure;
} VkDescriptorDataEXT;
-
pSampleris a pointer to a VkSampler handle specifying the parameters of a VK_DESCRIPTOR_TYPE_SAMPLER descriptor. -
pCombinedImageSampleris a pointer to a VkDescriptorImageInfo structure specifying the parameters of a VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER descriptor. -
pInputAttachmentImageis a pointer to a VkDescriptorImageInfo structure specifying the parameters of a VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT descriptor. -
pSampledImageis a pointer to a VkDescriptorImageInfo structure specifying the parameters of a VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE descriptor. -
pStorageImageis a pointer to a VkDescriptorImageInfo structure specifying the parameters of a VK_DESCRIPTOR_TYPE_STORAGE_IMAGE descriptor. -
pUniformTexelBufferis a pointer to a VkDescriptorAddressInfoEXT structure specifying the parameters of a VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER descriptor. -
pStorageTexelBufferis a pointer to a VkDescriptorAddressInfoEXT structure specifying the parameters of a VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER descriptor. -
pUniformBufferis a pointer to a VkDescriptorAddressInfoEXT structure specifying the parameters of a VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER descriptor. -
pStorageBufferis a pointer to a VkDescriptorAddressInfoEXT structure specifying the parameters of a VK_DESCRIPTOR_TYPE_STORAGE_BUFFER descriptor. -
accelerationStructureis the address of a VkAccelerationStructureKHR specifying the parameters of a VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR descriptor , or a VkAccelerationStructureNV handle specifying the parameters of a VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV descriptor.
If the nullDescriptor feature is enabled,
pSampledImage, pStorageImage, pUniformTexelBuffer,
pStorageTexelBuffer, pUniformBuffer, and pStorageBuffer
can each be NULL.
Loads from a null descriptor return zero values and stores and atomics to a
null descriptor are discarded.
If the nullDescriptor feature is enabled,
accelerationStructure can be 0.
A null acceleration structure descriptor results in the miss shader being
invoked.
Data describing a VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, or
VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER descriptor is passed in a
VkDescriptorAddressInfoEXT structure:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
typedef struct VkDescriptorAddressInfoEXT {
VkStructureType sType;
void* pNext;
VkDeviceAddress address;
VkDeviceSize range;
VkFormat format;
} VkDescriptorAddressInfoEXT;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
addressis either0or a device address at an offset in a buffer, where the base address can be queried from vkGetBufferDeviceAddress. -
rangeis the size in bytes of the buffer or buffer view used by the descriptor. -
formatis the format of the data elements in the buffer view and is ignored for buffers.
If the nullDescriptor feature is enabled,
address can be zero.
Loads from a null descriptor return zero values and stores and atomics to a
null descriptor are discarded.
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. |
The VkDescriptorGetTensorInfoARM is defined as:
// Provided by VK_EXT_descriptor_buffer with VK_ARM_tensors
typedef struct VkDescriptorGetTensorInfoARM {
VkStructureType sType;
const void* pNext;
VkTensorViewARM tensorView;
} VkDescriptorGetTensorInfoARM;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
tensorViewis a VkTensorViewARM handle specifying the parameters of a VK_DESCRIPTOR_TYPE_TENSOR_ARM descriptor.
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.
To bind descriptor buffers to a command buffer, call:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
void vkCmdBindDescriptorBuffersEXT(
VkCommandBuffer commandBuffer,
uint32_t bufferCount,
const VkDescriptorBufferBindingInfoEXT* pBindingInfos);
-
commandBufferis the command buffer that the descriptor buffers will be bound to. -
bufferCountis the number of elements in thepBindingInfosarray. -
pBindingInfosis a pointer to an array of VkDescriptorBufferBindingInfoEXT structures.
vkCmdBindDescriptorBuffersEXT causes any offsets previously set by
vkCmdSetDescriptorBufferOffsetsEXT that use the bindings numbered
[0..
bufferCount-1] to be no longer valid for subsequent bound pipeline
commands.
Any previously bound buffers at binding points greater than or equal to
bufferCount are unbound.
Data describing a descriptor buffer binding is passed in a
VkDescriptorBufferBindingInfoEXT structure:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
typedef struct VkDescriptorBufferBindingInfoEXT {
VkStructureType sType;
const void* pNext;
VkDeviceAddress address;
VkBufferUsageFlags usage;
} VkDescriptorBufferBindingInfoEXT;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
addressis aVkDeviceAddressspecifying the device address defining the descriptor buffer to be bound. -
usageis a bitmask of VkBufferUsageFlagBits specifying the VkBufferCreateInfo::usagefor the buffer from whichaddresswas queried. Usage flags other than VK_BUFFER_USAGE_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT, VK_BUFFER_USAGE_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT, and VK_BUFFER_USAGE_PUSH_DESCRIPTORS_DESCRIPTOR_BUFFER_BIT_EXT are ignored.
If the pNext chain includes a VkBufferUsageFlags2CreateInfo
structure, VkBufferUsageFlags2CreateInfo::usage from that
structure is used instead of usage from this structure.
When the VkPhysicalDeviceDescriptorBufferPropertiesEXT::bufferlessPushDescriptors
property is VK_FALSE, the VkBuffer handle of the buffer for push
descriptors is passed in a
VkDescriptorBufferBindingPushDescriptorBufferHandleEXT structure:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
typedef struct VkDescriptorBufferBindingPushDescriptorBufferHandleEXT {
VkStructureType sType;
const void* pNext;
VkBuffer buffer;
} VkDescriptorBufferBindingPushDescriptorBufferHandleEXT;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
bufferis theVkBufferhandle of the buffer for push descriptors.
To set descriptor buffer offsets in a command buffer, call:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
void vkCmdSetDescriptorBufferOffsetsEXT(
VkCommandBuffer commandBuffer,
VkPipelineBindPoint pipelineBindPoint,
VkPipelineLayout layout,
uint32_t firstSet,
uint32_t setCount,
const uint32_t* pBufferIndices,
const VkDeviceSize* pOffsets);
-
commandBufferis the command buffer in which the descriptor buffer offsets will be set. -
pipelineBindPointis a VkPipelineBindPoint indicating the type of the pipeline that will use the descriptors. -
layoutis a VkPipelineLayout object used to program the bindings. -
firstSetis the number of the first set to be bound. -
setCountis the number of elements in thepBufferIndicesandpOffsetsarrays. -
pBufferIndicesis a pointer to an array of indices into the descriptor buffer binding points set by vkCmdBindDescriptorBuffersEXT. -
pOffsetsis a pointer to an array ofVkDeviceSizeoffsets to apply to the bound descriptor buffers.
vkCmdSetDescriptorBufferOffsetsEXT binds setCount pairs of
descriptor buffers, specified by indices into the binding points bound using
vkCmdBindDescriptorBuffersEXT, and buffer offsets to set numbers
[firstSet..firstSet+setCount-1] for subsequent
bound pipeline commands set by
pipelineBindPoint.
Set [firstSet + i] is bound to the descriptor buffer at binding
pBufferIndices[i] at an offset of pOffsets[i].
Any bindings that were previously applied via these sets, or calls to
vkCmdBindDescriptorSets, are no longer valid.
Other sets will also be invalidated upon calling this command if
layout differs from the pipeline layout used to bind those other sets,
as described in Pipeline Layout Compatibility.
After binding descriptors, applications can modify descriptor memory either by performing writes on the host or with device commands. When descriptor memory is updated with device commands, visibility for the shader stage accessing a descriptor is ensured with the VK_ACCESS_2_DESCRIPTOR_BUFFER_READ_BIT_EXT access flag. Implementations must not access resources referenced by these descriptors unless they are dynamically accessed by shaders. Descriptors bound with this call can be undefined if they are not dynamically accessed by shaders.
Implementations may read descriptor data for any statically accessed
descriptor if the binding in layout is not declared with the
VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT flag.
If the binding in layout is declared with
VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT, implementations
must not read descriptor data that is not dynamically accessed.
Applications must ensure that any descriptor which the implementation may read must be in-bounds of the underlying descriptor buffer binding.
|
Applications can freely decide how large a variable descriptor buffer binding is, so it may not be safe to read such descriptor payloads statically. The intention of these rules is to allow implementations to speculatively prefetch descriptor payloads where feasible. |
Dynamically accessing a resource through descriptor data from an unbound region of a sparse partially-resident buffer will result in invalid descriptor data being read, and therefore undefined behavior.
|
For descriptors written by the host, visibility is implied through the
automatic visibility operation on queue submit, and there is no need to
consider |
|
The requirements above imply that all descriptor bindings have been defined with the equivalent of VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT and VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, but enabling those features is not required to get this behavior. |
To set descriptor buffer offsets in a command buffer, call:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_KHR_maintenance6 with VK_EXT_descriptor_buffer
void vkCmdSetDescriptorBufferOffsets2EXT(
VkCommandBuffer commandBuffer,
const VkSetDescriptorBufferOffsetsInfoEXT* pSetDescriptorBufferOffsetsInfo);
-
commandBufferis the command buffer in which the descriptor buffer offsets will be set. -
pSetDescriptorBufferOffsetsInfois a pointer to aVkSetDescriptorBufferOffsetsInfoEXTstructure.
The VkSetDescriptorBufferOffsetsInfoEXT structure is defined as:
// Provided by VK_KHR_maintenance6 with VK_EXT_descriptor_buffer
typedef struct VkSetDescriptorBufferOffsetsInfoEXT {
VkStructureType sType;
const void* pNext;
VkShaderStageFlags stageFlags;
VkPipelineLayout layout;
uint32_t firstSet;
uint32_t setCount;
const uint32_t* pBufferIndices;
const VkDeviceSize* pOffsets;
} VkSetDescriptorBufferOffsetsInfoEXT;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
stageFlagsis a bitmask of VkShaderStageFlagBits specifying the shader stages the descriptor sets will be bound to -
layoutis a VkPipelineLayout object used to program the bindings. If thedynamicPipelineLayoutfeature is enabled,layoutcan be VK_NULL_HANDLE and the layout must be specified by chaining VkPipelineLayoutCreateInfo structure off thepNext -
firstSetis the number of the first set to be bound. -
setCountis the number of elements in thepBufferIndicesandpOffsetsarrays. -
pBufferIndicesis a pointer to an array of indices into the descriptor buffer binding points set by vkCmdBindDescriptorBuffersEXT. -
pOffsetsis a pointer to an array ofVkDeviceSizeoffsets to apply to the bound descriptor buffers.
If stageFlags specifies a subset of all stages corresponding to one or
more pipeline bind points, the binding operation still affects all stages
corresponding to the given pipeline bind point(s) as if the equivalent
original version of this command had been called with the same parameters.
For example, specifying a stageFlags value of
VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT |
VK_SHADER_STAGE_COMPUTE_BIT is equivalent to calling the original
version of this command once with VK_PIPELINE_BIND_POINT_GRAPHICS and
once with VK_PIPELINE_BIND_POINT_COMPUTE.
To bind an embedded immutable sampler set to a command buffer, call:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
void vkCmdBindDescriptorBufferEmbeddedSamplersEXT(
VkCommandBuffer commandBuffer,
VkPipelineBindPoint pipelineBindPoint,
VkPipelineLayout layout,
uint32_t set);
-
commandBufferis the command buffer that the embedded immutable samplers will be bound to. -
pipelineBindPointis a VkPipelineBindPoint indicating the type of the pipeline that will use the embedded immutable samplers. -
layoutis a VkPipelineLayout object used to program the bindings. -
setis the number of the set to be bound.
vkCmdBindDescriptorBufferEmbeddedSamplersEXT binds the embedded immutable
samplers in set of layout to set for the command buffer
for subsequent bound pipeline commands set
by pipelineBindPoint.
Any previous binding to this set by vkCmdSetDescriptorBufferOffsetsEXT
or this command is overwritten.
Any sets that were last bound by a call to vkCmdBindDescriptorSets are
invalidated upon calling this command.
Other sets will also be invalidated upon calling this command if
layout differs from the pipeline layout used to bind those other sets,
as described in Pipeline Layout Compatibility.
To bind an embedded immutable sampler set to a command buffer, call:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_KHR_maintenance6 with VK_EXT_descriptor_buffer
void vkCmdBindDescriptorBufferEmbeddedSamplers2EXT(
VkCommandBuffer commandBuffer,
const VkBindDescriptorBufferEmbeddedSamplersInfoEXT* pBindDescriptorBufferEmbeddedSamplersInfo);
-
commandBufferis the command buffer that the embedded immutable samplers will be bound to. -
pBindDescriptorBufferEmbeddedSamplersInfois a pointer to aVkBindDescriptorBufferEmbeddedSamplersInfoEXTstructure.
The VkBindDescriptorBufferEmbeddedSamplersInfoEXT structure is defined
as:
// Provided by VK_KHR_maintenance6 with VK_EXT_descriptor_buffer
typedef struct VkBindDescriptorBufferEmbeddedSamplersInfoEXT {
VkStructureType sType;
const void* pNext;
VkShaderStageFlags stageFlags;
VkPipelineLayout layout;
uint32_t set;
} VkBindDescriptorBufferEmbeddedSamplersInfoEXT;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
stageFlagsis a bitmask of VkShaderStageFlagBits specifying the shader stages that will use the embedded immutable samplers. -
layoutis a VkPipelineLayout object used to program the bindings. If thedynamicPipelineLayoutfeature is enabled,layoutcan be VK_NULL_HANDLE and the layout must be specified by chaining VkPipelineLayoutCreateInfo structure off thepNext -
setis the number of the set to be bound.
If stageFlags specifies a subset of all stages corresponding to one or
more pipeline bind points, the binding operation still affects all stages
corresponding to the given pipeline bind point(s) as if the equivalent
original version of this command had been called with the same parameters.
For example, specifying a stageFlags value of
VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT |
VK_SHADER_STAGE_COMPUTE_BIT is equivalent to calling the original
version of this command once with VK_PIPELINE_BIND_POINT_GRAPHICS and
once with VK_PIPELINE_BIND_POINT_COMPUTE.
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.
To get the opaque descriptor data for a buffer, call:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
VkResult vkGetBufferOpaqueCaptureDescriptorDataEXT(
VkDevice device,
const VkBufferCaptureDescriptorDataInfoEXT* pInfo,
void* pData);
-
deviceis the logical device that gets the data. -
pInfois a pointer to a VkBufferCaptureDescriptorDataInfoEXT structure specifying the buffer. -
pDatais a pointer to an application-allocated buffer where the data will be written.
Information about the buffer to get descriptor buffer capture data for is
passed in a VkBufferCaptureDescriptorDataInfoEXT structure:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
typedef struct VkBufferCaptureDescriptorDataInfoEXT {
VkStructureType sType;
const void* pNext;
VkBuffer buffer;
} VkBufferCaptureDescriptorDataInfoEXT;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
bufferis theVkBufferhandle of the buffer to get opaque capture data for.
To get the opaque capture descriptor data for an image, call:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
VkResult vkGetImageOpaqueCaptureDescriptorDataEXT(
VkDevice device,
const VkImageCaptureDescriptorDataInfoEXT* pInfo,
void* pData);
-
deviceis the logical device that gets the data. -
pInfois a pointer to a VkImageCaptureDescriptorDataInfoEXT structure specifying the image. -
pDatais a pointer to an application-allocated buffer where the data will be written.
Information about the image to get descriptor buffer capture data for is
passed in a VkImageCaptureDescriptorDataInfoEXT structure:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
typedef struct VkImageCaptureDescriptorDataInfoEXT {
VkStructureType sType;
const void* pNext;
VkImage image;
} VkImageCaptureDescriptorDataInfoEXT;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
imageis theVkImagehandle of the image to get opaque capture data for.
To get the opaque capture descriptor data for an image view, call:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
VkResult vkGetImageViewOpaqueCaptureDescriptorDataEXT(
VkDevice device,
const VkImageViewCaptureDescriptorDataInfoEXT* pInfo,
void* pData);
-
deviceis the logical device that gets the data. -
pInfois a pointer to a VkImageViewCaptureDescriptorDataInfoEXT structure specifying the image view. -
pDatais a pointer to an application-allocated buffer where the data will be written.
Information about the image view to get descriptor buffer capture data for
is passed in a VkImageViewCaptureDescriptorDataInfoEXT structure:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
typedef struct VkImageViewCaptureDescriptorDataInfoEXT {
VkStructureType sType;
const void* pNext;
VkImageView imageView;
} VkImageViewCaptureDescriptorDataInfoEXT;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
imageViewis theVkImageViewhandle of the image view to get opaque capture data for.
To get the opaque capture descriptor data for a sampler, call:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
VkResult vkGetSamplerOpaqueCaptureDescriptorDataEXT(
VkDevice device,
const VkSamplerCaptureDescriptorDataInfoEXT* pInfo,
void* pData);
-
deviceis the logical device that gets the data. -
pInfois a pointer to a VkSamplerCaptureDescriptorDataInfoEXT structure specifying the sampler. -
pDatais a pointer to an application-allocated buffer where the data will be written.
Information about the sampler to get descriptor buffer capture data for is
passed in a VkSamplerCaptureDescriptorDataInfoEXT structure:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
typedef struct VkSamplerCaptureDescriptorDataInfoEXT {
VkStructureType sType;
const void* pNext;
VkSampler sampler;
} VkSamplerCaptureDescriptorDataInfoEXT;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
sampleris theVkSamplerhandle of the sampler to get opaque capture data for.
To get the opaque capture descriptor data for an acceleration structure, call:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer with VK_KHR_acceleration_structure or VK_NV_ray_tracing
VkResult vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT(
VkDevice device,
const VkAccelerationStructureCaptureDescriptorDataInfoEXT* pInfo,
void* pData);
-
deviceis the logical device that gets the data. -
pInfois a pointer to a VkAccelerationStructureCaptureDescriptorDataInfoEXT structure specifying the acceleration structure. -
pDatais a pointer to an application-allocated buffer where the data will be written.
Information about the acceleration structure to get descriptor buffer
capture data for is passed in a
VkAccelerationStructureCaptureDescriptorDataInfoEXT structure:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer with VK_KHR_acceleration_structure or VK_NV_ray_tracing
typedef struct VkAccelerationStructureCaptureDescriptorDataInfoEXT {
VkStructureType sType;
const void* pNext;
VkAccelerationStructureKHR accelerationStructure;
VkAccelerationStructureNV accelerationStructureNV;
} VkAccelerationStructureCaptureDescriptorDataInfoEXT;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
accelerationStructureis theVkAccelerationStructureKHRhandle of the acceleration structure to get opaque capture data for. -
accelerationStructureNVis theVkAccelerationStructureNVhandle of the acceleration structure to get opaque capture data for.
The VkOpaqueCaptureDescriptorDataCreateInfoEXT structure is defined
as:
| This functionality is superseded by VK_EXT_descriptor_heap. See Legacy Functionality for more information. |
// Provided by VK_EXT_descriptor_buffer
typedef struct VkOpaqueCaptureDescriptorDataCreateInfoEXT {
VkStructureType sType;
const void* pNext;
const void* opaqueCaptureDescriptorData;
} VkOpaqueCaptureDescriptorDataCreateInfoEXT;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
opaqueCaptureDescriptorDatais a pointer to an application-allocated buffer containing opaque capture data retrieved using vkGetBufferOpaqueCaptureDescriptorDataEXT, vkGetImageOpaqueCaptureDescriptorDataEXT, vkGetImageViewOpaqueCaptureDescriptorDataEXT, vkGetTensorOpaqueCaptureDescriptorDataARM, vkGetTensorViewOpaqueCaptureDescriptorDataARM, vkGetSamplerOpaqueCaptureDescriptorDataEXT, or vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT.
During replay, opaque descriptor capture data can be specified by adding a
VkOpaqueCaptureDescriptorDataCreateInfoEXT structure to the relevant
pNext chain of a VkBufferCreateInfo, VkImageCreateInfo,
VkImageViewCreateInfo, VkSamplerCreateInfo,
VkTensorCreateInfoARM, VkTensorViewCreateInfoARM,
VkAccelerationStructureCreateInfoNV or
VkAccelerationStructureCreateInfoKHR structure.
When providing opaque capture data for an image, if the pNext chain of
VkImageCreateInfo
or VkTensorCreateInfoARM
contains an instance of both this structure and
VkOpaqueCaptureDataCreateInfoEXT, they should both specify data from
the same original resource.
If they have capture data from different original resources, resource
creation is much more likely to fail.
To get the opaque capture descriptor data for a tensor, call:
// Provided by VK_EXT_descriptor_buffer with VK_ARM_tensors
VkResult vkGetTensorOpaqueCaptureDescriptorDataARM(
VkDevice device,
const VkTensorCaptureDescriptorDataInfoARM* pInfo,
void* pData);
-
deviceis the logical device that gets the data. -
pInfois a pointer to a VkTensorCaptureDescriptorDataInfoARM structure specifying the tensor. -
pDatais a pointer to a user-allocated buffer where the data will be written.
Information about the tensor to get descriptor buffer capture data for is
passed in a VkTensorCaptureDescriptorDataInfoARM structure:
// Provided by VK_EXT_descriptor_buffer with VK_ARM_tensors
typedef struct VkTensorCaptureDescriptorDataInfoARM {
VkStructureType sType;
const void* pNext;
VkTensorARM tensor;
} VkTensorCaptureDescriptorDataInfoARM;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
tensoris theVkTensorARMhandle of the tensor to get opaque capture data for.
To get the opaque capture descriptor data for a tensor view, call:
// Provided by VK_EXT_descriptor_buffer with VK_ARM_tensors
VkResult vkGetTensorViewOpaqueCaptureDescriptorDataARM(
VkDevice device,
const VkTensorViewCaptureDescriptorDataInfoARM* pInfo,
void* pData);
-
deviceis the logical device that gets the data. -
pInfois a pointer to a VkTensorViewCaptureDescriptorDataInfoARM structure specifying the tensor view. -
pDatais a pointer to a user-allocated buffer where the data will be written.
Information about the tensor view to get descriptor buffer capture data for
is passed in a VkTensorViewCaptureDescriptorDataInfoARM structure:
// Provided by VK_EXT_descriptor_buffer with VK_ARM_tensors
typedef struct VkTensorViewCaptureDescriptorDataInfoARM {
VkStructureType sType;
const void* pNext;
VkTensorViewARM tensorView;
} VkTensorViewCaptureDescriptorDataInfoARM;
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
tensorViewis theVkTensorViewARMhandle of the tensor view to get opaque capture data for.