Type Method

contextForOfflineGPUAtIndex:colorSpace:options:sharedContext:

Creates an OpenGL-based Core Image context using a GPU that is not currently driving a display, with the specified options.

Declaration

+ (CIContext *)contextForOfflineGPUAtIndex:(unsigned int)index colorSpace:(CGColorSpaceRef)colorSpace options:(NSDictionary<CIContextOption, id> *)options sharedContext:(CGLContextObj)sharedContext;

Parameters

index

The index of the offline GPU with which to create the context; a number between zero and the value returned by the offlineGPUCount method.

colorSpace

A color space object encapsulating color space information that is used to specify how color values are interpreted.

options

A dictionary that contains options for creating a CIContext object. You can pass any of the keys defined in Context Options along with the appropriate value.

sharedContext

A CGL context with which to share OpenGL resources, obtained by calling the CGL function CGLCreateContext. Pass NULL to use a context that does not share OpenGL resources.

Return Value

A Core Image context.

Discussion

GPU devices that are not currently being used to drive a display can be used for Core Image rendering. Use the offlineGPUCount method to determine whether any such GPUs are available.

To create a Metal-based Core Image context using an offline GPU, use the MTLCopyAllDevices function to list Metal devices, then choose a device without a display to pass to the contextWithMTLDevice: method.

See Also

Creating a Context for GPU-Based Rendering with OpenGL

+ contextWithCGLContext:pixelFormat:colorSpace:options:

Creates a Core Image context from a CGL context, using the specified options, color space, and pixel format object.

Deprecated
+ contextWithCGLContext:pixelFormat:options:

Creates a Core Image context from a CGL context, using the specified options and pixel format object.

Deprecated
+ contextWithEAGLContext:

Creates a Core Image context from an EAGL context.

Deprecated
+ contextWithEAGLContext:options:

Creates a Core Image context from an EAGL context using the specified options.

Deprecated
+ contextForOfflineGPUAtIndex:

Creates an OpenGL-based Core Image context using a GPU that is not currently driving a display.

Deprecated