VkDescriptorMappingSourcePushIndexEXT
The VkDescriptorMappingSourcePushIndexEXT structure is defined as:
typedef struct VkDescriptorMappingSourcePushIndexEXT {
uint32_t heapOffset;
uint32_t pushOffset;
uint32_t heapIndexStride;
uint32_t heapArrayStride;
const VkSamplerCreateInfo* pEmbeddedSampler;
VkBool32 useCombinedImageSamplerIndex;
uint32_t samplerHeapOffset;
uint32_t samplerPushOffset;
uint32_t samplerHeapIndexStride;
uint32_t samplerHeapArrayStride;
} VkDescriptorMappingSourcePushIndexEXT;
pub struct DescriptorMappingSourcePushIndexEXT {
heap_offset: u32,
push_offset: u32,
heap_index_stride: u32,
heap_array_stride: u32,
p_embedded_sampler: *const vk::SamplerCreateInfo,
use_combined_image_sampler_index: vk::Bool32,
sampler_heap_offset: u32,
sampler_push_offset: u32,
sampler_heap_index_stride: u32,
sampler_heap_array_stride: u32,
}
heapOffsetis a constant byte offset added to the heap address for the mapped resource or sampler.pushOffsetis an index into push data where an index into the heap for the mapped resource will be retrieved.heapIndexStrideis a constant byte stride that multiplies the index in push data.heapArrayStrideis a constant byte stride that multiplies the shader binding and array index.pEmbeddedSampleris an optional VkSamplerCreateInfo structure specifying a sampler to embed into the shader, in place of looking the sampler up in a heap.useCombinedImageSamplerIndexspecifies whether the generated index value will be decoded as two packed indices if the mapped resource is anOpTypeSampledImage.samplerHeapOffsetis used only when mapping a combined image sampler, used in place ofheapOffsetto retrieve the sampler.samplerPushOffsetis used only when mapping a combined image sampler, used in place ofpushOffsetto retrieve the sampler.samplerHeapIndexStrideis used only when mapping a combined image sampler, used in place ofheapIndexStrideto retrieve the sampler.samplerHeapArrayStrideis used only when mapping a combined image sampler, used in place ofheapArrayStrideto retrieve the sampler.
Resources using this mapping will be backed by a descriptor in the heap, at an offset calculated as
- pushIndex = ((uint32_t*)pPushData)[pushOffset/4]
- shaderIndex = (Binding - firstBinding) + arrayIndex
- offset = heapOffset + (pushIndex × heapIndexStride) + (shaderIndex × heapArrayStride)
where Binding is the binding value in the shader, arrayIndex is the index into the array if the shader binding is declared as an array, and pPushData is the total set of push data specified by vkCmdPushDataEXT.
If the mapped resource is a OpTypeSampledImage, offset is instead
calculated for the sampler as
- samplerPushIndex = ((uint32_t*)pPushData)[samplerPushOffset/4]
- offset = samplerHeapOffset + (samplerPushIndex × samplerHeapIndexStride) + (shaderIndex × samplerHeapArrayStride)
If useCombinedImageSamplerIndex is VK_TRUE, and the mapped
resource is a OpTypeSampledImage, pushIndex and
samplerPushIndex in the above equations are instead calculated as
- pushIndex = ((uint32_t*)pPushData)[pushOffset/4] & 0xFFFFF
- samplerPushIndex = (((uint32_t*)pPushData)[pushOffset/4] >> 20) & 0xFFF
If the mapped resource is a OpTypeSampler or OpTypeSampledImage,
and pEmbeddedSampler is not NULL, the specified embedded sampler
will be used rather than accessing the sampler heap.
Valid Usage
VUID-VkDescriptorMappingSourcePushIndexEXT-pushOffset-11258
pushOffset must be a multiple of 4
VUID-VkDescriptorMappingSourcePushIndexEXT-pushOffset-11259
pushOffset must be less than or equal to
maxPushDataSize - 4
VUID-VkDescriptorMappingSourcePushIndexEXT-pEmbeddedSampler-11446
If pEmbeddedSampler is a valid pointer to a
VkSamplerCreateInfo, its borderColor must not be
VK_BORDER_COLOR_FLOAT_CUSTOM_EXT or
VK_BORDER_COLOR_INT_CUSTOM_EXT
VUID-VkDescriptorMappingSourcePushIndexEXT-pEmbeddedSampler-11402
If pEmbeddedSampler is a valid pointer to a
VkSamplerCreateInfo, and there is a
VkDebugUtilsObjectNameInfoEXT structure in its pNext chain,
its objectType must be VK_OBJECT_TYPE_UNKNOWN
Valid Usage (Implicit)
VUID-VkDescriptorMappingSourcePushIndexEXT-pEmbeddedSampler-parameter
If pEmbeddedSampler is not NULL, pEmbeddedSampler must be a valid pointer to a valid VkSamplerCreateInfo structure