Represents an OpenCL context. More...
Public Member Functions | |
ComputeContext (ICollection< ComputeDevice > devices, ComputeContextPropertyList properties, ComputeContextNotifier notify, IntPtr notifyDataPtr) | |
Creates a new ComputeContext on a collection of ComputeDevice s. | |
ComputeContext (ComputeDeviceTypes deviceType, ComputeContextPropertyList properties, ComputeContextNotifier notify, IntPtr userDataPtr) | |
Creates a new ComputeContext on all the ComputeDevice s 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< ComputeDevice > | Devices [get] |
Gets a read-only collection of the ComputeDevice s of the ComputeContext . | |
ComputePlatform | Platform [get] |
Gets the ComputePlatform of the ComputeContext . | |
ComputeContextPropertyList | Properties [get] |
Gets a collection of ComputeContextProperty s of the ComputeContext . |
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);
Cloo.ComputeContext.ComputeContext | ( | ICollection< ComputeDevice > | devices, | |
ComputeContextPropertyList | properties, | |||
ComputeContextNotifier | notify, | |||
IntPtr | notifyDataPtr | |||
) |
Creates a new ComputeContext
on a collection of ComputeDevice
s.
devices | A collection of ComputeDevice s 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 ComputeDevice
s that match the specified ComputeDeviceTypes
.
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 . |
override void Cloo.ComputeContext.Dispose | ( | bool | manual | ) | [protected, virtual] |
Implements Cloo.ComputeResource.
override string Cloo.ComputeContext.ToString | ( | ) |
Gets the string representation of the ComputeContext
.
ComputeContext
. Reimplemented from Cloo.ComputeObject.
ReadOnlyCollection<ComputeDevice> Cloo.ComputeContext.Devices [get] |
Gets a read-only collection of the ComputeDevice
s of the ComputeContext
.
ComputePlatform Cloo.ComputeContext.Platform [get] |
Gets the ComputePlatform
of the ComputeContext
.
ComputeContextPropertyList Cloo.ComputeContext.Properties [get] |
Gets a collection of ComputeContextProperty
s of the ComputeContext
.