Contents

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

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

Declaration

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

Parameters

  • width:

    Width of the Mtltexture that will be returned by block.

  • height:

    Height of the Mtltexture that will be returned by block.

  • pixelFormat:

    Pixel format of the Mtltexture that will be returned by block.

  • commandBuffer:

    An optional Mtlcommandbuffer used for rendering to the Mtltexture.

  • block:

    Mtltexture-rendering provider block to be called lazily when the destination is rendered to. The block must return a texture of Mtltexturetype of Type2d.

Return Value

A CIRenderDestination object for rendering to a Metal texture.

Discussion

The destination’s colorSpace property will default to a CGColorSpace created with sRGB, extendedSRGB, or genericGrayGamma2_2.

See Also

Creating a Render Destination