---
title: MTLPixelFormat.x24_stencil8
framework: metal
role: symbol
role_heading: Case
path: metal/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.

## Declaration

```swift
case x24_stencil8
```

## Discussion

Discussion You can’t directly read the stencil value of a texture with the MTLPixelFormat.depth24Unorm_stencil8 format. To read stencil values from a texture with the MTLPixelFormat.depth24Unorm_stencil8 format, create a texture view of that texture using the MTLPixelFormat.x24_stencil8 format, and sample the texture view instead.

## See Also

### Depth and stencil pixel formats

- [MTLPixelFormat.depth16Unorm](metal/mtlpixelformat/depth16unorm.md)
- [MTLPixelFormat.depth32Float](metal/mtlpixelformat/depth32float.md)
- [MTLPixelFormat.stencil8](metal/mtlpixelformat/stencil8.md)
- [MTLPixelFormat.depth24Unorm_stencil8](metal/mtlpixelformat/depth24unorm_stencil8.md)
- [MTLPixelFormat.depth32Float_stencil8](metal/mtlpixelformat/depth32float_stencil8.md)
- [MTLPixelFormat.x32_stencil8](metal/mtlpixelformat/x32_stencil8.md)
