<!--
{
  "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/MTLStencilDescriptor/readMask",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTLStencilDescriptor(py)readMask"
  },
  "title" : "readMask"
}
-->

# readMask

A bitmask that determines from which bits that stencil comparison tests can read.

```
var readMask: UInt32 { get set }
```

## Discussion

The [`readMask`](/documentation/Metal/MTLStencilDescriptor/readMask) bits are used for logical AND operations to both the stored stencil value and the reference value.

The least significant bits of the read mask are used. The default value is all ones. A logical AND operation with the default [`readMask`](/documentation/Metal/MTLStencilDescriptor/readMask) does not change the value.

## See Also

[`setStencilReferenceValue(_:)`](/documentation/Metal/MTLRenderCommandEncoder/setStencilReferenceValue(_:))

Configures the same comparison value for front- and back-facing primitives.



---

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)