Public Member Functions | Protected Member Functions | Properties

Cloo.ComputeContext Class Reference

Represents an OpenCL context. More...

Inheritance diagram for Cloo.ComputeContext:
Cloo.ComputeResource Cloo.ComputeObject

List of all members.

Public Member Functions

 ComputeContext (ICollection< ComputeDevice > devices, ComputeContextPropertyList properties, ComputeContextNotifier notify, IntPtr notifyDataPtr)
 Creates a new ComputeContext on a collection of ComputeDevices.
 ComputeContext (ComputeDeviceTypes deviceType, ComputeContextPropertyList properties, ComputeContextNotifier notify, IntPtr userDataPtr)
 Creates a new ComputeContext on all the ComputeDevices that match the specified ComputeDeviceTypes.
override string ToString ()
 Gets the string representation of the ComputeContext.

Protected Member Functions

override void Dispose (bool manual)

Properties

ReadOnlyCollection< ComputeDeviceDevices [get]
 Gets a read-only collection of the ComputeDevices of the ComputeContext.
ComputePlatform Platform [get]
 Gets the ComputePlatform of the ComputeContext.
ComputeContextPropertyList Properties [get]
 Gets a collection of ComputeContextPropertys of the ComputeContext.

Detailed Description

Represents an OpenCL context.

The environment within which the kernels execute and the domain in which synchronization and memory management is defined.
This example shows how to create a ComputeContext that is able to share data with an OpenGL context in a Microsoft Windows OS:

        [DllImport("opengl32.dll")]
        extern static IntPtr wglGetCurrentDC();
        // ...
        IntPtr deviceContextHandle = wglGetCurrentDC();
        ComputePlatform platform = ComputePlatform.GetByName(nameOfPlatformCapableOfCLGLInterop);
        ComputeContextProperty p1 = new ComputeContextProperty(ComputeContextPropertyName.Platform, platform.Handle);
        ComputeContextProperty p2 = new ComputeContextProperty(ComputeContextPropertyName.CL_GL_CONTEXT_KHR, openGLContextHandle);
        ComputeContextProperty p3 = new ComputeContextProperty(ComputeContextPropertyName.CL_WGL_HDC_KHR, deviceContextHandle);
        ComputeContextPropertyList cpl = new ComputeContextPropertyList(new ComputeContextProperty[] { p1, p2, p3 });
        ComputeContext context = new ComputeContext(ComputeDeviceTypes.Gpu, cpl, null, IntPtr.Zero);
See also:
ComputeDevice, ComputePlatform

Constructor & Destructor Documentation

Cloo.ComputeContext.ComputeContext ( ICollection< ComputeDevice devices,
ComputeContextPropertyList  properties,
ComputeContextNotifier  notify,
IntPtr  notifyDataPtr 
)

Creates a new ComputeContext on a collection of ComputeDevices.

Parameters:
devices A collection of ComputeDevices to associate with the ComputeContext.
properties A ComputeContextPropertyList of the ComputeContext.
notify A callback function that can be registered by the application. This callback function will be used by the OpenCL implementation to report information on errors that occur in the ComputeContext. This callback function may be called asynchronously by the OpenCL implementation. It is the application's responsibility to ensure that the callback function is thread-safe. If notify is null, no callback function is registered.
notifyDataPtr Optional user data that will be passed to notify .
Cloo.ComputeContext.ComputeContext ( ComputeDeviceTypes  deviceType,
ComputeContextPropertyList  properties,
ComputeContextNotifier  notify,
IntPtr  userDataPtr 
)

Creates a new ComputeContext on all the ComputeDevices that match the specified ComputeDeviceTypes.

Parameters:
deviceType A bit-field that identifies the type of ComputeDevice to associate with the ComputeContext.
properties A ComputeContextPropertyList of the ComputeContext.
notify A callback function that can be registered by the application. This callback function will be used by the OpenCL implementation to report information on errors that occur in the ComputeContext. This callback function may be called asynchronously by the OpenCL implementation. It is the application's responsibility to ensure that the callback function is thread-safe. If notify is null, no callback function is registered.
userDataPtr Optional user data that will be passed to notify .

Member Function Documentation

override void Cloo.ComputeContext.Dispose ( bool  manual  )  [protected, virtual]

Implements Cloo.ComputeResource.

override string Cloo.ComputeContext.ToString (  ) 

Gets the string representation of the ComputeContext.

Returns:
The string representation of the ComputeContext.

Reimplemented from Cloo.ComputeObject.


Property Documentation

ReadOnlyCollection<ComputeDevice> Cloo.ComputeContext.Devices [get]

Gets a read-only collection of the ComputeDevices of the ComputeContext.

ComputePlatform Cloo.ComputeContext.Platform [get]

Gets the ComputePlatform of the ComputeContext.

ComputeContextPropertyList Cloo.ComputeContext.Properties [get]

Gets a collection of ComputeContextPropertys of the ComputeContext.


The documentation for this class was generated from the following file: