public Event EnqueueCopyImage( Image source, Ibasa.Numerics.Vector3ul sourceOrigin, Image destination, Ibasa.Numerics.Vector3ul destinationOrigin, Ibasa.Numerics.Vector3ul region, ulong rowPitch, ulong slicePitch, Event[] events) { ClHelper.ThrowNullException(Handle); if (source == Image.Null) { throw new ArgumentNullException("source"); } if (destination == Image.Null) { throw new ArgumentNullException("destination"); } unsafe { int num_events_in_wait_list = events == null ? 0 : events.Length; IntPtr *wait_list = stackalloc IntPtr[num_events_in_wait_list]; for (int i = 0; i < num_events_in_wait_list; ++i) { wait_list[i] = events[i].Handle; } if (events == null) { wait_list = null; } IntPtr event_ptr = IntPtr.Zero; UIntPtr *sourceOrigin_ptr = stackalloc UIntPtr[3]; sourceOrigin_ptr[0] = new UIntPtr(sourceOrigin.X); sourceOrigin_ptr[1] = new UIntPtr(sourceOrigin.Y); sourceOrigin_ptr[2] = new UIntPtr(sourceOrigin.Z); UIntPtr *destinationOrigin_ptr = stackalloc UIntPtr[3]; destinationOrigin_ptr[0] = new UIntPtr(destinationOrigin.X); destinationOrigin_ptr[1] = new UIntPtr(destinationOrigin.Y); destinationOrigin_ptr[2] = new UIntPtr(destinationOrigin.Z); UIntPtr *region_ptr = stackalloc UIntPtr[3]; region_ptr[0] = new UIntPtr(region.X); region_ptr[1] = new UIntPtr(region.Y); region_ptr[2] = new UIntPtr(region.Z); ClHelper.GetError(Cl.EnqueueCopyImage(Handle, source.Handle, destination.Handle, sourceOrigin_ptr, destinationOrigin_ptr, region_ptr, (uint)num_events_in_wait_list, wait_list, &event_ptr)); return(new Event(event_ptr)); } }