Instance Method

render:toMTLTexture:commandBuffer:bounds:colorSpace:

Renders a region of an image to a Metal texture.

Declaration

- (void)render:(CIImage *)image toMTLTexture:(id<MTLTexture>)texture commandBuffer:(id<MTLCommandBuffer>)commandBuffer bounds:(CGRect)bounds colorSpace:(CGColorSpaceRef)colorSpace;

Parameters

image

A Core Image image object.

texture

The destination Metal texture object.

commandBuffer

The Metal command buffer into which to schedule Core Image rendering tasks.

bounds

The rectangle in the destination texture to draw into.

colorSpace

The color space of the destination texture.

Discussion

If you specify nil for the commandBuffer parameter, Core Image manages its own Metal command buffer. To combine Core Image rendering with other Metal rendering tasks—for example, to use Core Image filters on textures whose content is generated by a Metal render-to-texture operation, or to use Core Image output later in the same Metal rendering pass—pass the same MTLCommandBuffer object you use for those tasks.

Rendering to a Metal texture requires a Metal-based context created with the contextWithMTLDevice: or contextWithMTLDevice:options: method. Calling this method on any other context raises an exception. This method renders only to Metal textures whose texture type is MTLTextureType2D and whose sampleCount value is 1.

See Also

Rendering Images

- createCGImage:fromRect:

Creates a Quartz 2D image from a region of a Core Image image object.

- createCGImage:fromRect:format:colorSpace:

Creates a Quartz 2D image from a region of a Core Image image object.

- createCGImage:fromRect:format:colorSpace:deferred:

Creates a Quartz 2D image from a region of a Core Image image object with deferred rendering.

- createCGLayerWithSize:info:

Creates a CGLayer object from the provided parameters.

Deprecated
- render:toCVPixelBuffer:

Renders an image into a pixel buffer.

- render:toCVPixelBuffer:bounds:colorSpace:

Renders a region of an image into a pixel buffer.

- render:toIOSurface:bounds:colorSpace:

Renders a region of an image into an IOSurface object.