---
title: "makeDepthStencilState(descriptor:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtldevice/makedepthstencilstate(descriptor:)"
---

# makeDepthStencilState(descriptor:)

Creates a depth-stencil state instance.

## Declaration

```swift
func makeDepthStencilState(descriptor: MTLDepthStencilDescriptor) -> (any MTLDepthStencilState)?
```

## Parameters

- `descriptor`: An doc://com.apple.metal/documentation/Metal/MTLDepthStencilDescriptor instance.

## Return Value

Return Value A new MTLDepthStencilState instance if the method completed successfully; otherwise nil.
