<!--
{
  "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(width:height:pixelFormat:commandBuffer:mtlTextureProvider:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIRenderDestination(im)initWithWidth:height:pixelFormat:commandBuffer:mtlTextureProvider:"
  },
  "title" : "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.

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

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

## Discussion

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)