Ejemplo n.º 1
0
 /// <summary>
 /// Enqueue a two dimensional kernel for launch.
 /// </summary>
 public void EnqueueLaunch(CommandQueue queue, Dim2D globalWorkSize, Dim2D localWorkSize, out Event evt)
 {
     unsafe {
         IntPtr evtHandle = IntPtr.Zero;
         Native.Call(Native.EnqueueNDRangeKernel(queue.Handle, this.Handle, 2, null, (IntPtr *)(&globalWorkSize), (IntPtr *)(&localWorkSize), 0, null, &evtHandle));
         evt = new Event(evtHandle);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Launch a two dimensional kernel and block until completed.
        /// </summary>
        public void Launch(CommandQueue queue, Dim2D globalWorkSize, Dim2D localWorkSize)
        {
            Event evt;

            this.EnqueueLaunch(queue, globalWorkSize, localWorkSize, out evt);
            evt.Wait();
            evt.Dispose();
        }
Ejemplo n.º 3
0
        public IntPtr Map(CommandQueue queue, MapFlags flags, Offset2D origin, Dim2D region, out IntPtr pitch)
        {
            Offset3D  origin_buf = new Offset3D(origin.X, origin.Y, (IntPtr)0);
            Dim3D     region_buf = new Dim3D(region.X, region.Y, (IntPtr)1);
            IntPtr    tempPitch  = IntPtr.Zero;
            ErrorCode errorCode;
            IntPtr    result = IntPtr.Zero;

            unsafe {
                result = Native.EnqueueMapImage(queue.Handle, this.Handle, true, flags, &origin_buf, &region_buf, &tempPitch, null, 0, null, null, &errorCode);
                pitch  = tempPitch;
            }
            if (errorCode != ErrorCode.Success)
            {
                throw new OpenCLCallFailedException(errorCode);
            }
            return(result);
        }
Ejemplo n.º 4
0
        public IntPtr EnqueueMap(CommandQueue queue, MapFlags flags, Offset2D origin, Dim2D region, out IntPtr pitch, Event[] waitList, out Event evt)
        {
            Offset3D origin_buf = new Offset3D(origin.X, origin.Y, (IntPtr)0);
            Dim3D    region_buf = new Dim3D(region.X, region.Y, (IntPtr)1);
            IntPtr   tempPitch  = IntPtr.Zero;
            uint     waitCount  = (waitList == null ? 0 : (uint)waitList.Length);

            IntPtr[]  wlh       = CLObject.GetHandles(waitList);
            IntPtr    evtHandle = IntPtr.Zero;
            ErrorCode errorCode;
            IntPtr    result = IntPtr.Zero;

            unsafe {
                result = Native.EnqueueMapImage(queue.Handle, this.Handle, true, flags, &origin_buf, &region_buf, &tempPitch, null, waitCount, wlh, &evtHandle, &errorCode);
            }
            if (errorCode != ErrorCode.Success)
            {
                throw new OpenCLCallFailedException(errorCode);
            }
            pitch = tempPitch;
            evt   = new Event(evtHandle);
            return(result);
        }