Platforms to show: All Mac Windows Linux Cross-Platform

Back to CLContextMBS class.

CLContextMBS.Constructor(Device as CLDeviceMBS, ErrorHandlerMode as Integer = 0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an OpenCL context.
Example
dim devices(-1) as CLDeviceMBS = OpenCLMBS.AllDevices(CLDeviceMBS.kDeviceTypeGPU)
dim device as CLDeviceMBS = devices(0) // we use first one

// Create a context
dim context as new CLContextMBS(device, CLContextMBS.kErrorModeLogMessagesToSystemLog)

Platform: Optional, Specifies the platform to use.
Devices: The devices you want to use. Can be one or several devices. If you specify none, the default one is picked.
ErrorHandlerMode: The error handler mode. Check kErrorMode* constants.

Lasterror is set.

See also:

CLContextMBS.Constructor(Devices() as CLDeviceMBS, ErrorHandlerMode as Integer = 0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an OpenCL context.

Platform: Optional, specifies the platform to use.
Devices: The devices you want to use. Can be one or several devices. If you specify none, the default one is picked.
ErrorHandlerMode: The error handler mode. Check kErrorMode* constants.

Lasterror is set.

See also:

CLContextMBS.Constructor(DeviceType as Integer, ErrorHandlerMode as Integer = 0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Create an OpenCL context from a device type that identifies the specific device(s) to use.
Example
dim co as new CLContextMBS(CLDeviceMBS.kDeviceTypeAll)

Platform: Optional, Specifies the platform to use.
DeviceType: A bit-field that identifies the type of device and is described in the table below.
ErrorHandlerMode: The error handler mode. Check kErrorMode* constants.

ConstantsDescription
kDeviceTypeCPUAn OpenCL device that is the host processor. The host processor runs the OpenCL implementations and is a single or multi-core CPU.
kDeviceTypeGPUAn OpenCL device that is a GPU. By this we mean that the device can also be used to accelerate a 3D API such as OpenGL or DirectX.
kDeviceTypeAcceleratorDedicated OpenCL accelerators (for example the IBM CELL Blade). These devices communicate with the host processor using a peripheral interconnect such as PCIe.
kDeviceTypeDefaultThe default OpenCL device in the system.
kDeviceTypeAllAll OpenCL devices available in the system.
Lasterror is set.

See also:

CLContextMBS.Constructor(Platform as CLPlatformMBS, Device as CLDeviceMBS, ErrorHandlerMode as Integer = 0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an OpenCL context.

Platform: Specifies the platform to use.
Devices: The devices you want to use. Can be one or several devices. If you specify none, the default one is picked.
ErrorHandlerMode: The error handler mode. Check kErrorMode* constants.

Lasterror is set.

See also:

CLContextMBS.Constructor(Platform as CLPlatformMBS, Devices() as CLDeviceMBS, ErrorHandlerMode as Integer = 0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an OpenCL context.

Platform: Specifies the platform to use.
Devices: The devices you want to use. Can be one or several devices. If you specify none, the default one is picked.
ErrorHandlerMode: The error handler mode. Check kErrorMode* constants.

Lasterror is set.

See also:

CLContextMBS.Constructor(Platform as CLPlatformMBS, DeviceType as Integer, ErrorHandlerMode as Integer = 0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Create an OpenCL context from a device type that identifies the specific device(s) to use.

Platform: Optional, Specifies the platform to use.
DeviceType: A bit-field that identifies the type of device and is described in the table below.
ErrorHandlerMode: The error handler mode. Check kErrorMode* constants.

ConstantsDescription
kDeviceTypeCPUAn OpenCL device that is the host processor. The host processor runs the OpenCL implementations and is a single or multi-core CPU.
kDeviceTypeGPUAn OpenCL device that is a GPU. By this we mean that the device can also be used to accelerate a 3D API such as OpenGL or DirectX.
kDeviceTypeAcceleratorDedicated OpenCL accelerators (for example the IBM CELL Blade). These devices communicate with the host processor using a peripheral interconnect such as PCIe.
kDeviceTypeDefaultThe default OpenCL device in the system.
kDeviceTypeAllAll OpenCL devices available in the system.
Lasterror is set.

See also:

CLContextMBS.Devices as CLDeviceMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the list of devices in context.
Example
// create context for all devices
dim co as new CLContextMBS(CLDeviceMBS.kDeviceTypeAll)

// and query it for it's devices
for each d as CLDeviceMBS in co.Devices
MsgBox d.Name
next

CLContextMBS.GetSupportedImageFormats(flags as UInt64, type as UInt32) as CLImageFormatMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Get the list of image formats supported by an OpenCL implementation.
Example
dim co as new CLContextMBS(CLDeviceMBS.kDeviceTypeAll)

dim formats(-1) as CLImageFormatMBS = co.GetSupportedImageFormats(CLMemMBS.kMemoryReadWrite, CLMemMBS.kMemoryTypeImage2D)
dim lines(-1) as string

for each f as CLImageFormatMBS in formats
// see constants for what this values mean
lines.Append hex(f.ImageChannelOrder)+" - "+hex(f.ImageChannelDataType)
next

MsgBox Join(lines,EndOfLine)

self: A valid OpenCL context on which the image object(s) will be created.
flags: A bit-field that is used to specify allocation and usage information about the image memory object being created and is described in the List of supported cl_mem_flags values for clCreateBuffer
type: Describes the image type and must be either kMemoryTypeImage2D or kMemoryTypeImage3D.

Returns an array of imageformat objects.

CLContextMBS.ReferenceCount as UInt32

Type Topic Plugin Version macOS Windows Linux iOS Targets
method OpenCL MBS MacFrameworks Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Return the context reference count.
Example
dim devices(-1) as CLDeviceMBS = OpenCLMBS.AllDevices(CLDeviceMBS.kDeviceTypeGPU)
dim device as CLDeviceMBS = devices(0) // we use first one

// Create a context
dim context as new CLContextMBS(device, CLContextMBS.kErrorModeLogMessagesToSystemLog)

MsgBox str(context.ReferenceCount) // 1

// Create a command queue
dim queue as new CLCommandQueueMBS(context, device, 0)

MsgBox str(context.ReferenceCount) // 2 as the command queue points to the context, too.

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


The biggest plugin in space...