drawPrimitives(primitiveType:vertexStart:vertexCount:)
Encodes a draw command that renders an instance of a geometric primitive.
Declaration
func drawPrimitives(primitiveType: MTLPrimitiveType, vertexStart: Int, vertexCount: Int)Parameters
- primitiveType:
A Mtlprimitivetype representing how the command interprets vertex argument data.
- vertexStart:
The lowest value the command passes to your vertex shader function’s parameter with the
[[vertex_id]]attribute. - vertexCount:
An integer that represents the number of vertices of
primitiveTypethe command draws.
Discussion
This command assigns each vertex a unique vertex_id value that increases from vertexStart through (vertexStart + vertexCount - 1).
Your vertex shader function can use this value to uniquely identify each vertex.