internal Context(Platform platform, ContextProperties[] properties, Device[] devices) { IntPtr[] intPtrProperties; IntPtr[] deviceIDs; ErrorCode result; Platform = platform; deviceIDs = InteropTools.ConvertDevicesToDeviceIDs(devices); intPtrProperties = new IntPtr[properties.Length]; for (int i = 0; i < properties.Length; i++) { intPtrProperties[i] = new IntPtr((long)properties[i]); } ContextID = (IntPtr)OpenCL.CreateContext(intPtrProperties, (uint)devices.Length, deviceIDs, null, IntPtr.Zero, out result); if (result != ErrorCode.SUCCESS) { throw new OpenCLException("CreateContext failed: " + result, result); } Is64BitContext = ContainsA64BitDevice(); }
public Context CreateContext(IntPtr[] contextProperties, Device[] devices, ContextNotify notify, IntPtr userData) { IntPtr contextID; ErrorCode result; IntPtr[] deviceIDs = InteropTools.ConvertDevicesToDeviceIDs(devices); contextID = (IntPtr)OpenCL.CreateContext(contextProperties, (uint)deviceIDs.Length, deviceIDs, notify, userData, out result); if (result != ErrorCode.SUCCESS) { throw new OpenCLException("CreateContext failed with error code: " + result, result); } return(new Context(this, contextID)); }
public Context CreateDefaultContext(ContextNotify notify, IntPtr userData) { var properties = new[] { new IntPtr((Int64)ContextProperties.PLATFORM), this.PlatformID, IntPtr.Zero }; IntPtr contextID; ErrorCode result; contextID = OpenCL.CreateContext(properties, (UInt32)this.DeviceIDs.Length, this.DeviceIDs, notify, userData, out result); if (result != ErrorCode.SUCCESS) { throw new OpenCLException("CreateContext failed with error code: " + result, result); } return(new Context(this, contextID)); }