C Specification
The VkDescriptorSetAndBindingMappingEXT structure is defined as:
// Provided by VK_EXT_descriptor_heap
typedef struct VkDescriptorSetAndBindingMappingEXT {
VkStructureType sType;
const void* pNext;
uint32_t descriptorSet;
uint32_t firstBinding;
uint32_t bindingCount;
VkSpirvResourceTypeFlagsEXT resourceMask;
VkDescriptorMappingSourceEXT source;
VkDescriptorMappingSourceDataEXT sourceData;
} VkDescriptorSetAndBindingMappingEXT;
Members
-
sTypeis a VkStructureType value identifying this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
descriptorSetis the value ofDescriptorSetfor resources that this mapping affects. -
firstBindingis the first value ofBindingof resources that this mapping affects. -
bindingCountis the number of consecutiveBindingvalues of resources that this mapping affects. -
resourceMaskis a mask of VkSpirvResourceTypeFlagBitsEXT values indicating which resource types are specified by this mapping. -
sourceis a VkDescriptorMappingSourceEXT value specifying the method of mapping specified for the affected resources. -
sourceDatais a VkDescriptorMappingSourceDataEXT that provides the details of how each mapping is specified according tosource.
Description
Resources specified in a shader with a DescriptorSet decoration set to
descriptorSet, a Binding decoration greater than or equal to
firstBinding and less than the sum of firstBinding and
bindingCount, and a resource type matching one of the bits in
resourceMask will be mapped according to source and
sourceData.
|
Note
|
Applications are free to overspecify bindings that are not present; allowing
reuse of the same mapping structures with multiple shaders, even when those
shaders only partially reuse those mappings.
This includes things like setting binding counts higher than the number used
in the shader, specifying bindings that are not present in the shader, and
setting |
If source selects an element of sourceData defined by a
structure, the description of that structure defines how resources are
mapped.
Source mappings using a single base type are defined here.
If source is
VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_CONSTANT_OFFSET_EXT, the
resource will be backed by heap data as specified by
constantOffset.
If source is
VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_PUSH_INDEX_EXT, the resource
will be backed by heap data as specified by
pushIndex.
If source is
VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_INDIRECT_INDEX_EXT, the
resource will be backed by heap data as specified by
indirectIndex.
If source is
VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_INDIRECT_INDEX_ARRAY_EXT, the
resource will be backed by heap data as specified by
indirectIndexArray.
If source is
VK_DESCRIPTOR_MAPPING_SOURCE_RESOURCE_HEAP_DATA_EXT, the resource will
be backed by heap data as specified by
heapData.
If source is VK_DESCRIPTOR_MAPPING_SOURCE_PUSH_DATA_EXT, the
resource will be backed by push data at a range from pushDataOffset to
the size of the resource, allowing a uniform buffer to be backed by push
data access push data.
Accessing data in the uniform buffer at an offset of shaderOffset in
the shader will access push data at an offset equal to
-
offset = shaderOffset + pushDataOffset.
If source is VK_DESCRIPTOR_MAPPING_SOURCE_PUSH_ADDRESS_EXT, the
resource will be backed by data pointed to by a device address in push data
at an offset of pushAddressOffset.
Accessing data via the mapped resource in the shader will access data
backing the address specified in push data:
-
address = ((VkDeviceAddress*)pPushData)[pushAddressOffset/8]
where pPushData is the total set of push data specified by vkCmdPushDataEXT. If the shader resource is an acceleration structure, the address must be a valid acceleration structure address.
If source is VK_DESCRIPTOR_MAPPING_SOURCE_INDIRECT_ADDRESS_EXT,
the resource will be backed by heap data as specified by
indirectAddress.
|
Note
|
Accesses to resources using mappings to anything that is not a descriptor in a heap are not subject to robustness guarantees; resources for such mappings must not be accessed out of bounds. |
If source is
VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_SHADER_RECORD_INDEX_EXT, the
resource will be backed by heap data as specified by
shaderRecordIndex.
If source is
VK_DESCRIPTOR_MAPPING_SOURCE_SHADER_RECORD_DATA_EXT, the resource will
be backed by shader record data at a range from shaderRecordDataOffset
to the size of the resource, allowing a uniform buffer to be used as a way
to access shader record data.
Accessing data in the uniform buffer at an offset shaderOffset in the
shader will access shader record data at an offset equal to
-
offset = shaderOffset + shaderRecordDataOffset.
If source is
VK_DESCRIPTOR_MAPPING_SOURCE_SHADER_RECORD_ADDRESS_EXT, the resource
will be backed by data pointed to by a device address in the shader record
at shaderRecordAddressOffset.
Accessing data via the mapped resource in the shader will access data
backing the address specified in shader record data:
-
address = ((VkDeviceAddress*)pShaderRecordData)[shaderRecordAddressOffset/8]
where pShaderRecord is the memory associated with a given shader as its shader record. If the shader resource is an acceleration structure, the address must be a valid acceleration structure address.
|
Note
|
Accesses to resources using VK_DESCRIPTOR_MAPPING_SOURCE_SHADER_RECORD_ADDRESS_EXT mappings are not subject to robustness guarantees; data must not be accessed outside of the allocated memory range. |
Mappings must be declared for all variables with a DescriptorSet and
Binding in the shader resource interface.
Document Notes
For more information, see the Vulkan Specification.
This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.