---
title: "init(mtlTexture:commandBuffer:)"
framework: coreimage
role: symbol
role_heading: Initializer
path: "coreimage/cirenderdestination/init(mtltexture:commandbuffer:)-2iu5i"
---

# init(mtlTexture:commandBuffer:)

Creates a render destination based on a Metal texture.

## Declaration

```swift
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

Return Value A CIRenderDestination object for rendering to a Metal buffer.

## Discussion

Discussion Rendering to a MTLTexture-backed CIRenderDestination is supported by only MTLTexture-backed CIContext objects.  The texture must have MTLTextureType of MTLTextureType.type2D. The destination’s colorSpace property will default to a CGColorSpace created with sRGB, extendedSRGB, or genericGrayGamma2_2.

## See Also

### Creating a Render Destination

- [init(pixelBuffer:)](coreimage/cirenderdestination/init(pixelbuffer:).md)
- [init(ioSurface:)](coreimage/cirenderdestination/init(iosurface:)-1hfcq.md)
- [init(width:height:pixelFormat:commandBuffer:mtlTextureProvider:)](coreimage/cirenderdestination/init(width:height:pixelformat:commandbuffer:mtltextureprovider:).md)
- [init(glTexture:target:width:height:)](coreimage/cirenderdestination/init(gltexture:target:width:height:)-9ci8e.md)
- [init(bitmapData:width:height:bytesPerRow:format:)](coreimage/cirenderdestination/init(bitmapdata:width:height:bytesperrow:format:).md)
