C Specification
To set descriptor buffer offsets in a command buffer, call:
// 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);
Parameters
-
commandBuffer
is the command buffer in which the descriptor buffer offsets will be set. -
pipelineBindPoint
is a VkPipelineBindPoint indicating the type of the pipeline that will use the descriptors. -
layout
is a VkPipelineLayout object used to program the bindings. -
firstSet
is the number of the first set to be bound. -
setCount
is the number of elements in thepBufferIndices
andpOffsets
arrays. -
pBufferIndices
is a pointer to an array of indices into the descriptor buffer binding points set by vkCmdBindDescriptorBuffersEXT. -
pOffsets
is a pointer to an array of VkDeviceSize offsets to apply to the bound descriptor buffers.
Description
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
+descriptorSetCount
-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.
Note
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.
Note
For descriptors written by the host, visibility is implied through the
automatic visibility operation on queue submit, and there is no need to
consider |
Note
The requirements above imply that all descriptor bindings have been defined
with the equivalent of |
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.