Ejemplo n.º 1
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.º 2
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);
        }