---
title: writeMask
framework: metal
role: symbol
role_heading: Instance Property
path: metal/mtlstencildescriptor/writemask
---

# writeMask

A bitmask that determines to which bits that stencil operations can write.

## Declaration

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

## Discussion

Discussion writeMask are used for logical AND operations to values that are going to be written into a stencil attachment as the result of a stencil operation. The least significant bits of the write mask are used. The default value is all ones. A logical AND operation with the default writeMask does not change the value.

## See Also

### Configuring stencil bit mask properties

- [readMask](metal/mtlstencildescriptor/readmask.md)
