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);
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 the
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 the
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
The assembled primitives execute the bound graphics pipeline.
vertexCount is calculated as follows:
const uint32_t * counterBufferPtr = (const uint8_t *)counterBuffer.address + counterBufferOffset; vertexCount = floor(max(0, (*counterBufferPtr - counterOffset)) / vertexStride);
firstVertex is zero.
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 (c) 2014-2019 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.