<!--
{
  "availability" : [
    "macOS: 10.10.0 - 10.14.0",
    "swift: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIContext/init(forOfflineGPUAtIndex:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Image",
      "CoreImage"
    ],
    "preciseIdentifier" : "c:objc(cs)CIContext(cm)contextForOfflineGPUAtIndex:::SYNTHESIZED::c:objc(cs)CIContext"
  },
  "title" : "init(forOfflineGPUAtIndex:)"
}
-->

# init(forOfflineGPUAtIndex:)

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

```
init?(forOfflineGPUAtIndex index: UInt32)
```

## 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()`](/documentation/CoreImage/CIContext/offlineGPUCount()) method.

## 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()`](/documentation/CoreImage/CIContext/offlineGPUCount()) method to determine whether any such GPUs are available.

To create a Metal-based Core Image context using an offline GPU, use the <doc://com.apple.documentation/documentation/Metal/MTLCopyAllDevices()> function to list Metal devices, then choose a device without a display to pass to the [`init(mtlDevice:)`](/documentation/CoreImage/CIContext/init(mtlDevice:)-swey) method.

---

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)