---
title: depthCompareFunction
framework: metal
role: symbol
role_heading: Instance Property
path: metal/mtldepthstencildescriptor/depthcomparefunction
---

# depthCompareFunction

The comparison that is performed between a fragment’s depth value and the depth value in the attachment, which determines whether to discard the fragment.

## Declaration

```swift
var depthCompareFunction: MTLCompareFunction { get set }
```

## Discussion

Discussion The default value is MTLCompareFunction.always, which indicates that the depth test always passes and the fragment remains a candidate to replace the data at the specified location. For more information on possible values, see MTLCompareFunction.

## See Also

### Related Documentation

- [Metal Shading Language Guide](apple-archive/documentation/Metal/Reference/MetalShadingLanguageGuide/Introduction.md)
- [Metal Programming Guide](apple-archive/documentation/Miscellaneous/Conceptual/MetalProgrammingGuide/Introduction.md)

### Specifying depth operations

- [isDepthWriteEnabled](metal/mtldepthstencildescriptor/isdepthwriteenabled.md)
