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

            this.EnqueueLaunch(queue, globalWorkSize, localWorkSize, out evt);
            evt.Wait();
            evt.Dispose();
        }
예제 #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);
        }
예제 #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);
        }