---
title: clearStencil
framework: metal
role: symbol
role_heading: Instance Property
path: metal/mtlrenderpassstencilattachmentdescriptor/clearstencil
---

# clearStencil

The value to use when clearing the stencil attachment.

## Declaration

```swift
var clearStencil: UInt32 { get set }
```

## Discussion

Discussion If the loadAction property of the attachment is set to MTLLoadAction.clear, then at the start of a render pass, the GPU fills the contents of the attachment with the value stored in the clearStencil property. Otherwise, the GPU ignores clearStencil. The default value is 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)
