Пример #1
0
 IntPtr ICL10.EnqueueMapImage(CLCommandQueueHandle command_queue, CLMemoryHandle image, bool blocking_map,
                              ComputeMemoryMappingFlags map_flags, ref SysIntX3 origin, ref SysIntX3 region,
                              out IntPtr image_row_pitch, out IntPtr image_slice_pitch, int num_events_in_wait_list,
                              CLEventHandle[] event_wait_list, CLEventHandle[] new_event, out ComputeErrorCode errcode_ret)
 {
     return(EnqueueMapImage(command_queue, image, blocking_map, map_flags, ref origin, ref region, out image_row_pitch, out image_slice_pitch, num_events_in_wait_list, event_wait_list, new_event, out errcode_ret));
 }
Пример #2
0
        /// <summary>
        /// Enqueues a command to map a part of a buffer into the host address space.
        /// </summary>
        /// <param name="buffer"> The buffer to map. </param>
        /// <param name="blocking">  The mode of operation of this call. </param>
        /// <param name="flags"> A list of properties for the mapping mode. </param>
        /// <param name="offset"> The <paramref name="buffer"/> element position where mapping starts. </param>
        /// <param name="region"> The region of elements to map. </param>
        /// <param name="events"> A collection of events that need to complete before this particular command can be executed. If <paramref name="events"/> is not <c>null</c> or read-only a new <see cref="ComputeEvent"/> identifying this command is created and attached to the end of the collection. </param>
        /// <remarks> If <paramref name="blocking"/> is <c>true</c> this method will not return until the command completes. If <paramref name="blocking"/> is <c>false</c> this method will return immediately after the command is enqueued. </remarks>
        public IntPtr Map <T>(ComputeBufferBase <T> buffer, bool blocking, ComputeMemoryMappingFlags flags, long offset, long region, ICollection <ComputeEventBase> events) where T : struct
        {
            int sizeofT = HDSPUtils.SizeOf(typeof(T));

            int eventWaitListSize;

            CLEventHandle[] eventHandles   = ComputeTools.ExtractHandles(events, out eventWaitListSize);
            bool            eventsWritable = (events != null && !events.IsReadOnly);

            CLEventHandle[] newEventHandle = (eventsWritable) ? new CLEventHandle[1] : null;

            IntPtr mappedPtr = IntPtr.Zero;

            ComputeErrorCode error = ComputeErrorCode.Success;

            mappedPtr = CL10.EnqueueMapBuffer(Handle, buffer.Handle, blocking, flags, new IntPtr(offset * sizeofT), new IntPtr(region * sizeofT), eventWaitListSize, eventHandles, newEventHandle, out error);
            ComputeException.ThrowOnError(error);

            if (eventsWritable)
            {
                events.Add(new ComputeEvent(newEventHandle[0], this));
            }

            return(mappedPtr);
        }
Пример #3
0
 public extern static IntPtr EnqueueMapBuffer(
     CLCommandQueueHandle command_queue,
     CLMemoryHandle buffer,
     [MarshalAs(UnmanagedType.Bool)] bool blocking_map,
     ComputeMemoryMappingFlags map_flags,
     IntPtr offset,
     IntPtr cb,
     Int32 num_events_in_wait_list,
     [MarshalAs(UnmanagedType.LPArray)] CLEventHandle[] event_wait_list,
     [Out, MarshalAs(UnmanagedType.LPArray, SizeConst = 1)] CLEventHandle[] new_event,
     out ComputeErrorCode errcode_ret);
Пример #4
0
 public extern static IntPtr EnqueueMapImage(
     CLCommandQueueHandle command_queue,
     CLMemoryHandle image,
     [MarshalAs(UnmanagedType.Bool)] bool blocking_map,
     ComputeMemoryMappingFlags map_flags,
     ref SysIntX3 origin,
     ref SysIntX3 region,
     out IntPtr image_row_pitch,
     out IntPtr image_slice_pitch,
     Int32 num_events_in_wait_list,
     [MarshalAs(UnmanagedType.LPArray)] CLEventHandle[] event_wait_list,
     [Out, MarshalAs(UnmanagedType.LPArray, SizeConst = 1)] CLEventHandle[] new_event,
     out ComputeErrorCode errcode_ret);
Пример #5
0
        /// <summary>
        /// Enqueues a command to map a part of a <see cref="ComputeImage"/> into the host address space.
        /// </summary>
        /// <param name="image"> The <see cref="ComputeImage"/> to map. </param>
        /// <param name="blocking"> The mode of operation of this command. If <c>true</c> this call will not return until the command has finished execution. </param>
        /// <param name="flags"> A list of properties for the mapping mode. </param>
        /// <param name="offset"> The <paramref name="image"/> element position where mapping starts. </param>
        /// <param name="region"> The region of elements to map. </param>
        /// <param name="events"> A collection of events that need to complete before this particular command can be executed. If <paramref name="events"/> is not <c>null</c> or read-only a new <see cref="ComputeEvent"/> identifying this command is created and attached to the end of the collection. </param>
        /// <remarks> If <paramref name="blocking"/> is <c>true</c> this method will not return until the command completes. If <paramref name="blocking"/> is <c>false</c> this method will return immediately after the command is enqueued. </remarks>
        public IntPtr Map(ComputeImage image, bool blocking, ComputeMemoryMappingFlags flags, SysIntX3 offset, SysIntX3 region, ICollection <ComputeEventBase> events)
        {
            int eventWaitListSize;

            CLEventHandle[] eventHandles   = ComputeTools.ExtractHandles(events, out eventWaitListSize);
            bool            eventsWritable = (events != null && !events.IsReadOnly);

            CLEventHandle[] newEventHandle = (eventsWritable) ? new CLEventHandle[1] : null;

            IntPtr mappedPtr, rowPitch, slicePitch;

            ComputeErrorCode error = ComputeErrorCode.Success;

            mappedPtr = CL10.EnqueueMapImage(Handle, image.Handle, blocking, flags, ref offset, ref region, out rowPitch, out slicePitch, eventWaitListSize, eventHandles, newEventHandle, out error);
            ComputeException.ThrowOnError(error);

            if (eventsWritable)
            {
                events.Add(new ComputeEvent(newEventHandle[0], this));
            }

            return(mappedPtr);
        }
Пример #6
0
 public static extern IntPtr EnqueueMapImage(
     CLCommandQueueHandle command_queue,
     CLMemoryHandle image,
     [MarshalAs(UnmanagedType.Bool)] bool blocking_map,
     ComputeMemoryMappingFlags map_flags,
     ref SysIntX3 origin,
     ref SysIntX3 region,
     out IntPtr image_row_pitch,
     out IntPtr image_slice_pitch,
     Int32 num_events_in_wait_list,
     [MarshalAs(UnmanagedType.LPArray)] CLEventHandle[] event_wait_list,
     [Out, MarshalAs(UnmanagedType.LPArray, SizeConst = 1)] CLEventHandle[] new_event,
     out ComputeErrorCode errcode_ret);
Пример #7
0
 public static extern IntPtr EnqueueMapBuffer(
     CLCommandQueueHandle command_queue,
     CLMemoryHandle buffer,
     [MarshalAs(UnmanagedType.Bool)] bool blocking_map,
     ComputeMemoryMappingFlags map_flags,
     IntPtr offset,
     IntPtr cb,
     Int32 num_events_in_wait_list,
     [MarshalAs(UnmanagedType.LPArray)] CLEventHandle[] event_wait_list,
     [Out, MarshalAs(UnmanagedType.LPArray, SizeConst = 1)] CLEventHandle[] new_event,
     out ComputeErrorCode errcode_ret);
Пример #8
0
 public ComputeErrorCode EnqueueSVMMap(CLCommandQueueHandle command_queue, ComputeBoolean blocking_map, ComputeMemoryMappingFlags flags, IntPtr svm_ptr, IntPtr size, int num_events_in_wait_list, [MarshalAs(UnmanagedType.LPArray)] CLEventHandle[] event_wait_list, out CLEventHandle new_event)
 {
     throw new NotImplementedException();
 }
Пример #9
0
 public IntPtr EnqueueMapImage(CLCommandQueueHandle command_queue, CLMemoryHandle image, [MarshalAs(UnmanagedType.Bool)] bool blocking_map, ComputeMemoryMappingFlags map_flags, ref SysIntX3 origin, ref SysIntX3 region, out IntPtr image_row_pitch, out IntPtr image_slice_pitch, Int32 num_events_in_wait_list, [MarshalAs(UnmanagedType.LPArray)] CLEventHandle[] event_wait_list, out CLEventHandle new_event, out ComputeErrorCode errcode_ret)
 {
     return StaticEnqueueMapImage(command_queue, image, blocking_map, map_flags, ref origin, ref region, out image_row_pitch, out image_slice_pitch, num_events_in_wait_list, event_wait_list, out new_event, out errcode_ret);
 }
Пример #10
0
 public IntPtr EnqueueMapBuffer(CLCommandQueueHandle command_queue, CLMemoryHandle buffer, [MarshalAs(UnmanagedType.Bool)] bool blocking_map, ComputeMemoryMappingFlags map_flags, IntPtr offset, IntPtr cb, Int32 num_events_in_wait_list, [MarshalAs(UnmanagedType.LPArray)] CLEventHandle[] event_wait_list, out CLEventHandle new_event, out ComputeErrorCode errcode_ret)
 {
     return StaticEnqueueMapBuffer(command_queue, buffer, blocking_map, map_flags, offset, cb, num_events_in_wait_list, event_wait_list, out new_event, out errcode_ret);
 }
Пример #11
0
 public static unsafe extern IntPtr EnqueueMapImage(
     IntPtr command_queue,
     IntPtr image,
     ComputeBoolean blocking_map,
     ComputeMemoryMappingFlags map_flags,
     IntPtr* origin,
     IntPtr* region,
     IntPtr* image_row_pitch,
     IntPtr* image_slice_pitch,
     Int32 num_events_in_wait_list,
     IntPtr* event_wait_list,
     IntPtr* new_event,
     ComputeErrorCode* errcode_ret);
Пример #12
0
 public static unsafe extern IntPtr EnqueueMapBuffer(
     IntPtr command_queue,
     IntPtr buffer,
     ComputeBoolean blocking_map,
     ComputeMemoryMappingFlags map_flags,
     IntPtr offset,
     IntPtr cb,
     Int32 num_events_in_wait_list,
     IntPtr* event_wait_list,
     IntPtr* new_event,
     ComputeErrorCode* errcode_ret);
Пример #13
0
 IntPtr ICL10.EnqueueMapImage(CLCommandQueueHandle command_queue, CLMemoryHandle image, bool blocking_map,
                              ComputeMemoryMappingFlags map_flags, ref SysIntX3 origin, ref SysIntX3 region,
                              out IntPtr image_row_pitch, out IntPtr image_slice_pitch, int num_events_in_wait_list,
                              CLEventHandle[] event_wait_list, CLEventHandle[] new_event, out ComputeErrorCode errcode_ret)
 {
     return EnqueueMapImage(command_queue, image, blocking_map, map_flags, ref origin, ref region, out image_row_pitch, out image_slice_pitch, num_events_in_wait_list, event_wait_list, new_event, out errcode_ret);
 }
Пример #14
0
 IntPtr ICL10.EnqueueMapBuffer(CLCommandQueueHandle command_queue, CLMemoryHandle buffer, bool blocking_map,
                               ComputeMemoryMappingFlags map_flags, IntPtr offset, IntPtr cb, int num_events_in_wait_list,
                               CLEventHandle[] event_wait_list, CLEventHandle[] new_event, out ComputeErrorCode errcode_ret)
 {
     return EnqueueMapBuffer(command_queue, buffer, blocking_map, map_flags, offset, cb, num_events_in_wait_list, event_wait_list, new_event, out errcode_ret);
 }
Пример #15
0
 public static extern ComputeErrorCode StaticEnqueueSVMMap(CLCommandQueueHandle command_queue, ComputeBoolean blocking_map, ComputeMemoryMappingFlags flags, IntPtr svm_ptr, IntPtr size, Int32 num_events_in_wait_list, [MarshalAs(UnmanagedType.LPArray)] CLEventHandle[] event_wait_list, out CLEventHandle new_event);
Пример #16
0
 IntPtr ICL10.EnqueueMapBuffer(CLCommandQueueHandle command_queue, CLMemoryHandle buffer, bool blocking_map,
                               ComputeMemoryMappingFlags map_flags, IntPtr offset, IntPtr cb, int num_events_in_wait_list,
                               CLEventHandle[] event_wait_list, CLEventHandle[] new_event, out ComputeErrorCode errcode_ret)
 {
     return(EnqueueMapBuffer(command_queue, buffer, blocking_map, map_flags, offset, cb, num_events_in_wait_list, event_wait_list, new_event, out errcode_ret));
 }