public ComputeProgram(ComputeContext context, string source) { handle = CL10.CreateProgramWithSource(context.handle, 1, new[] { source }, null, out _); #if DEBUG Trace.WriteLine("Create " + this + " in Thread(" + Thread.CurrentThread.ManagedThreadId + ").", "Information"); #endif }
public ComputeCommandQueue(ComputeContext context, ComputeDevice device, ComputeCommandQueueFlags properties) { handle = CL10.CreateCommandQueue(context.handle, device.handle, properties, out _); this.device = device; this.context = context; Events = new List <ComputeEvent>(); #if DEBUG Trace.WriteLine("Create " + this + " in Thread(" + Thread.CurrentThread.ManagedThreadId + ").", "Information"); #endif }
public ComputeBuffer(ComputeContext context, ComputeMemoryFlags flags, T[] data) { GCHandle dataPtr = GCHandle.Alloc(data, GCHandleType.Pinned); try { handle = CL10.CreateBuffer(context.handle, flags, new IntPtr(Unsafe.SizeOf <T>() * data.Length), dataPtr.AddrOfPinnedObject(), out _); } finally { dataPtr.Free(); } Init(); }
public ComputeBuffer(ComputeContext context, ComputeMemoryFlags flags, long count, IntPtr dataPtr) { handle = CL10.CreateBuffer(context.handle, flags, new IntPtr(Unsafe.SizeOf <T>() * count), dataPtr, out _); Init(); }
public ComputeBuffer(ComputeContext context, ComputeMemoryFlags flags, long count) : this(context, flags, count, IntPtr.Zero) { }