<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIRenderDestination/init(mtlTexture:commandBuffer:)-2iu5i",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIRenderDestination(im)initWithMTLTexture:commandBuffer:"
  },
  "title" : "init(mtlTexture:commandBuffer:)"
}
-->

# init(mtlTexture:commandBuffer:)

Creates a render destination based on a Metal texture.

```
init(mtlTexture texture: any MTLTexture, commandBuffer: (any MTLCommandBuffer)?)
```

## Parameters

`texture`

The <doc://com.apple.documentation/documentation/Metal/MTLTexture> object for rendering with <doc://com.apple.documentation/documentation/Metal/MTLTextureType> of <doc://com.apple.documentation/documentation/Metal/MTLTextureType/type2D>.

`commandBuffer`

An optional <doc://com.apple.documentation/documentation/Metal/MTLCommandBuffer> to use for rendering to the <doc://com.apple.documentation/documentation/Metal/MTLTexture> destination.

## Return Value

A [`CIRenderDestination`](/documentation/CoreImage/CIRenderDestination) object for rendering to a Metal buffer.

## Discussion

Rendering to a <doc://com.apple.documentation/documentation/Metal/MTLTexture>-backed [`CIRenderDestination`](/documentation/CoreImage/CIRenderDestination) is supported by only <doc://com.apple.documentation/documentation/Metal/MTLTexture>-backed [`CIContext`](/documentation/CoreImage/CIContext) objects.  The texture must have <doc://com.apple.documentation/documentation/Metal/MTLTextureType> of <doc://com.apple.documentation/documentation/Metal/MTLTextureType/type2D>.

The destination’s [`colorSpace`](/documentation/CoreImage/CIRenderDestination/colorSpace) property will default to a <doc://com.apple.documentation/documentation/CoreGraphics/CGColorSpace> created with <doc://com.apple.documentation/documentation/CoreGraphics/CGColorSpace/sRGB>, <doc://com.apple.documentation/documentation/CoreGraphics/CGColorSpace/extendedSRGB>, or <doc://com.apple.documentation/documentation/CoreGraphics/CGColorSpace/genericGrayGamma2_2>.

---

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)