---
title: maxCallStackDepth
framework: metal
role: symbol
role_heading: Instance Property
path: metal/mtlcomputepipelinedescriptor/maxcallstackdepth
---

# maxCallStackDepth

The maximum call stack depth for indirect function calls in compute shaders.

## Declaration

```swift
var maxCallStackDepth: Int { get set }
```

## Discussion

Discussion The property’s default value is 1. Change its value if you use recursive functions in your compute pass. The maximum call stack depth applies only to indirect function calls in your shader, and affects the upper bound of stack memory for each thread. Indirect function calls include those to visible functions, intersection functions, and to dynamic libraries. tip: To avoid a runtime performance impact, keep this value as small as possible because the framework reserves a large call stack.

## See Also

### Configuring the compute execution environment

- [computeFunction](metal/mtlcomputepipelinedescriptor/computefunction.md)
- [threadGroupSizeIsMultipleOfThreadExecutionWidth](metal/mtlcomputepipelinedescriptor/threadgroupsizeismultipleofthreadexecutionwidth.md)
- [maxTotalThreadsPerThreadgroup](metal/mtlcomputepipelinedescriptor/maxtotalthreadsperthreadgroup.md)
