---
title: stepFunction
framework: metal
role: symbol
role_heading: Instance Property
path: metal/mtlvertexbufferlayoutdescriptor/stepfunction
---

# stepFunction

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

## Declaration

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

## Discussion

Discussion The default value is MTLVertexStepFunction.perVertex. If stepFunction is 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, 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, 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

### Related Documentation

- [Metal Shading Language Guide](apple-archive/documentation/Metal/Reference/MetalShadingLanguageGuide/Introduction.md)
- [Metal Programming Guide](apple-archive/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Introduction.md)

### Organizing the vertex buffer layout

- [stepRate](metal/mtlvertexbufferlayoutdescriptor/steprate.md)
- [stride](metal/mtlvertexbufferlayoutdescriptor/stride.md)
- [MTLVertexStepFunction](metal/mtlvertexstepfunction.md)
