<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 - 27.0.0",
    "macOS: 10.12.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLPixelFormat/x24_stencil8",
  "metadataVersion" : "0.1.0",
  "role" : "Case",
  "symbol" : {
    "kind" : "Case",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:@E@MTLPixelFormat@MTLPixelFormatX24_Stencil8"
  },
  "title" : "MTLPixelFormat.x24_stencil8"
}
-->

# MTLPixelFormat.x24_stencil8

A stencil pixel format used to read the stencil value from a texture with a combined 24-bit depth and 8-bit stencil value.

```
case x24_stencil8
```

## Discussion

You can’t directly read the stencil value of a texture with the [`MTLPixelFormat.depth24Unorm_stencil8`](/documentation/Metal/MTLPixelFormat/depth24Unorm_stencil8) format. To read stencil values from a texture with the [`MTLPixelFormat.depth24Unorm_stencil8`](/documentation/Metal/MTLPixelFormat/depth24Unorm_stencil8) format, create a texture view of that texture using the [`MTLPixelFormat.x24_stencil8`](/documentation/Metal/MTLPixelFormat/x24_stencil8) format, and sample the texture view instead.

---

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)