<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLVertexBufferLayoutDescriptor/stepFunction",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTLVertexBufferLayoutDescriptor(py)stepFunction"
  },
  "title" : "stepFunction"
}
-->

# stepFunction

The circumstances under which the vertex and its attributes are presented to the vertex function.

```
var stepFunction: MTLVertexStepFunction { get set }
```

## Discussion

The default value is [`MTLVertexStepFunction.perVertex`](/documentation/Metal/MTLVertexStepFunction/perVertex).

If `stepFunction` is [`MTLVertexStepFunction.perVertex`](/documentation/Metal/MTLVertexStepFunction/perVertex), the function fetches new attribute data based on the `[[ vertex_id ]]` attribute qualifier. The function fetches new attribute data each time a new vertex is processed. In this case, `stepRate` needs to be set to `1`, which is its default value.

If `stepFunction` is [`MTLVertexStepFunction.perInstance`](/documentation/Metal/MTLVertexStepFunction/perInstance), the function fetches new attribute data based on the `[[ instance_id ]]` attribute qualifier.  In this case, `stepRate` needs to be greater than `0` and its value determines how often the function fetches new attribute data.

If `stepFunction` is [`MTLVertexStepFunction.constant`](/documentation/Metal/MTLVertexStepFunction/constant), the function fetches attribute data just once, and that attribute data is used for every vertex. In this case,`stepRate` needs to be set to `0`.

## See Also

  [Metal Shading Language Guide](https://developer.apple.com/library/archive/documentation/Metal/Reference/MetalShadingLanguageGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40014364)

  [Metal Programming Guide](https://developer.apple.com/library/archive/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40014221)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)