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

# clearDepth

The depth to use when clearing the depth attachment.

```
var clearDepth: Double { get set }
```

## Discussion

If the [`loadAction`](/documentation/Metal/MTLRenderPassAttachmentDescriptor/loadAction) property of the attachment is set to [`MTLLoadAction.clear`](/documentation/Metal/MTLLoadAction/clear), then at the start of a render pass, the GPU fills the contents of the attachment with the value stored in the [`clearDepth`](/documentation/Metal/MTLRenderPassDepthAttachmentDescriptor/clearDepth) property. Otherwise, the GPU ignores [`clearDepth`](/documentation/Metal/MTLRenderPassDepthAttachmentDescriptor/clearDepth).

The default value is `1.0`.

---

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)