---
title: "init(width:height:pixelFormat:commandBuffer:mtlTextureProvider:)"
framework: coreimage
role: symbol
role_heading: Initializer
path: "coreimage/cirenderdestination/init(width:height:pixelformat:commandbuffer:mtltextureprovider:)"
---

# init(width:height:pixelFormat:commandBuffer:mtlTextureProvider:)

Creates a render destination based on a Metal texture with specified pixel format.

## Declaration

```swift
init(width: Int, height: Int, pixelFormat: MTLPixelFormat, commandBuffer: (any MTLCommandBuffer)?, mtlTextureProvider block: (() -> any MTLTexture)? = nil)
```

## Parameters

- `width`: Width of the doc://com.apple.documentation/documentation/Metal/MTLTexture that will be returned by block.
- `height`: Height of the doc://com.apple.documentation/documentation/Metal/MTLTexture that will be returned by block.
- `pixelFormat`: Pixel format of the doc://com.apple.documentation/documentation/Metal/MTLTexture that will be returned by block.
- `commandBuffer`: An optional doc://com.apple.documentation/documentation/Metal/MTLCommandBuffer used for rendering to the doc://com.apple.documentation/documentation/Metal/MTLTexture.
- `block`: doc://com.apple.documentation/documentation/Metal/MTLTexture-rendering provider block to be called lazily when the destination is rendered to. The block must return a texture of doc://com.apple.documentation/documentation/Metal/MTLTextureType of doc://com.apple.documentation/documentation/Metal/MTLTextureType/type2D.

## Return Value

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

## Discussion

Discussion 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(mtlTexture:commandBuffer:)](coreimage/cirenderdestination/init(mtltexture:commandbuffer:)-2iu5i.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)
