C Specification
To record a non-indexed draw call, where the vertex count is based on a byte count read from a buffer and the passed in vertex stride parameter, call:
void vkCmdDrawIndirectByteCountEXT(
VkCommandBuffer commandBuffer,
uint32_t instanceCount,
uint32_t firstInstance,
VkBuffer counterBuffer,
VkDeviceSize counterBufferOffset,
uint32_t counterOffset,
uint32_t vertexStride);
Parameters
-
commandBufferis the command buffer into which the command is recorded. -
instanceCountis the number of instances to draw. -
firstInstanceis the instance ID of the first instance to draw. -
counterBufferis the buffer handle from where the byte count is read. -
counterBufferOffsetis the offset into the buffer used to read the byte count, which is used to calculate the vertex count for this draw call. -
counterOffsetis subtracted from the byte count read from thecounterBufferat thecounterBufferOffset -
vertexStrideis the stride in bytes between each element of the vertex data that is used to calculate the vertex count from the counter value. This value is typically the same value that was used in the graphics pipeline state when the transform feedback was captured as theXfbStride.
Description
When the command is executed, primitives are assembled in the same way as
done with vkCmdDraw except the vertexCount is calculated based
on the byte count read from counterBuffer at offset
counterBufferOffset.
The assembled primitives execute the bound graphics pipeline.
The effective vertexCount is calculated as follows:
const uint32_t * counterBufferPtr = (const uint8_t *)counterBuffer.address + counterBufferOffset;
vertexCount = floor(max(0, (*counterBufferPtr - counterOffset)) / vertexStride);
The effective firstVertex is zero.
See Also
VkBuffer, VkCommandBuffer, VkDeviceSize
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.
Copyright
Copyright (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.