<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalKit",
  "identifier" : "/documentation/MetalKit/MTKView/depthStencilPixelFormat",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "MetalKit"
    ],
    "preciseIdentifier" : "c:objc(cs)MTKView(py)depthStencilPixelFormat"
  },
  "title" : "depthStencilPixelFormat"
}
-->

# depthStencilPixelFormat

The format used to generate the [`depthStencilTexture`](/documentation/MetalKit/MTKView/depthStencilTexture) object.

```
var depthStencilPixelFormat: MTLPixelFormat { get set }
```

## Discussion

The default value is <doc://com.apple.documentation/documentation/Metal/MTLPixelFormat/invalid>, which means that the view doesn’t create a depth and stencil texture. If you set it to a different format, the view automatically creates those textures for you and configures them as part of any render passes that the view creates.

---

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)