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

# renderTargetArrayLength

The number of active layers that all attachments need to have for layered rendering.

```
var renderTargetArrayLength: Int { get set }
```

## Discussion

The default value is `0`, indicating that the GPU does not use layered rendering on this render pass.

The table below gives typical values you might set, depending on the type of texture being used as attachments in the render pass. Your vertex shader need to select the render target array index between `0` and the array length minus `1`.

|Texture Type                                                                                                                                        |Typical Length                                                                                                |
|----------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|
|``doc://com.apple.metal/documentation/Metal/MTLTextureType/type1DArray`` or ``doc://com.apple.metal/documentation/Metal/MTLTextureType/type2DArray``|The length of the texture array (``doc://com.apple.metal/documentation/Metal/MTLTexture/arrayLength``)        |
|``doc://com.apple.metal/documentation/Metal/MTLTextureType/typeCube``                                                                               |6                                                                                                             |
|``doc://com.apple.metal/documentation/Metal/MTLTextureType/typeCubeArray``                                                                          |6 times the length of the texture array (``doc://com.apple.metal/documentation/Metal/MTLTexture/arrayLength``)|

---

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)