To get the offset of a binding within a descriptor set layout in memory, call:
// 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 to VkDeviceSize where 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
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
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
for samplers and
binding must have the largest offset of any
binding with type
can be used.
Any potential types in
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.
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.