Initializer

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: MTLCommandBuffer?, mtlTextureProvider block: (() -> 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 MTLTextureType.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

init(pixelBuffer: CVPixelBuffer)

Creates a render destination based on a Core Video pixel buffer.

init(ioSurface: IOSurface)

Creates a render destination based on an IOSurface object.

init(mtlTexture: MTLTexture, commandBuffer: MTLCommandBuffer?)

Creates a render destination based on a Metal texture.

init(glTexture: UInt32, target: UInt32, width: Int, height: Int)

Creates a render destination based on an OpenGL texture.