public Event EnqueueFillBuffer(Image image, IntPtr fillColor, Ibasa.Numerics.Vector3ul origin, Ibasa.Numerics.Vector3ul region, ulong offset, ulong size, Event[] events) { ClHelper.ThrowNullException(Handle); if (image == Image.Null) { throw new ArgumentNullException("image"); } if (fillColor == IntPtr.Zero) { throw new ArgumentNullException("fillColor"); } 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 *origin_ptr = stackalloc UIntPtr[3]; origin_ptr[0] = new UIntPtr(origin.X); origin_ptr[1] = new UIntPtr(origin.Y); origin_ptr[2] = new UIntPtr(origin.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.EnqueueFillImage(Handle, image.Handle, fillColor.ToPointer(), origin_ptr, region_ptr, (uint)num_events_in_wait_list, wait_list, &event_ptr)); return(new Event(event_ptr)); } }