Example #1
0
        private static Event WriteBytesInternal(CLMem openCLMem, CommandQueue commandQueue, Array array, Int64 bytesToCopy, Int64 arrayOffset, Int64 arraySize, Int64 bufferOffset, Int64 bufferSize, Events eventWaitList, WriteOperation writeDelegate)
        {
            if (bufferSize < bufferOffset + bytesToCopy) throw new ArgumentException(Resources.Buffer_out_of_bounds);
            if (arraySize < arrayOffset + bytesToCopy) throw new ArgumentException(Resources.Array_out_of_bounds);

            GCHandle valueHandle = GCHandle.Alloc(array, GCHandleType.Pinned);

            try
            {
                CLEvent e = new CLEvent();

                unsafe
                {
                    IntPtr valuePtr = new IntPtr((Byte*)(valueHandle.AddrOfPinnedObject().ToPointer()) + arrayOffset);

                    OpenCLError.Validate
                    (
                        writeDelegate
                        (
                            commandQueue.CLCommandQueue,
                            openCLMem,
                            CLBool.True,
                            new SizeT(bufferOffset),
                            new SizeT(bytesToCopy),
                            valuePtr,
                            eventWaitList == null ? 0 : eventWaitList.Count,
                            eventWaitList == null ? null : eventWaitList.OpenCLEventArray,
                            ref e
                        )
                    );
                }

                return new Event(e);
            }
            finally
            {
                valueHandle.Free();
            }
        }
Example #2
0
 internal static extern CLError clGetGLTextureInfo(CLMem memobj, int param_name, SizeT param_value_size, IntPtr param_value, ref SizeT param_value_size_ret);
Example #3
0
 internal static extern CLError clEnqueueCopyImageToBuffer(CLCommandQueue command_queue, CLMem src_image, CLMem dst_buffer, SizeT[] src_origin, SizeT[] region, SizeT dst_offset, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e);
Example #4
0
 internal static extern IntPtr clEnqueueMapImage(CLCommandQueue command_queue, CLMem image, CLBool blocking_map, CLMapFlags map_flags, SizeT[] origin, SizeT[] region, ref SizeT image_row_pitch, ref SizeT image_slice_pitch, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e, ref CLError errcode_ret);
Example #5
0
 internal static extern CLError clReleaseMemObject(CLMem memobj);
Example #6
0
 internal static extern CLError clSetKernelArg(CLKernel kernel, int arg_index, SizeT arg_size, CLMem[] arg_value);
Example #7
0
 internal static extern CLError clSetKernelArg(CLKernel kernel, int arg_index, SizeT arg_size, ref CLMem arg_value);
Example #8
0
 internal static extern CLError clGetImageInfo(CLMem image, CLImageInfo param_name, SizeT param_value_size, IntPtr param_value, ref SizeT param_value_size_ret);
Example #9
0
 internal static extern CLError clReleaseMemObject(CLMem memobj);
Example #10
0
 internal static extern CLError clRetainMemObject(CLMem memobj);
Example #11
0
 internal static extern CLError clGetMemObjectInfo(CLMem memobj, CLMemInfo param_name, SizeT param_value_size, IntPtr param_value, ref SizeT param_value_size_ret);
Example #12
0
 internal static extern CLError clGetImageInfo(CLMem image, CLImageInfo param_name, SizeT param_value_size, IntPtr param_value, ref SizeT param_value_size_ret);
Example #13
0
 internal static extern CLError clEnqueueUnmapMemObject(CLCommandQueue command_queue, CLMem memobj, IntPtr mapped_ptr, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e);
Example #14
0
 internal static extern CLError clEnqueueWriteBuffer(CLCommandQueue command_queue, CLMem buffer, CLBool blocking_write, SizeT offset, SizeT cb, IntPtr ptr, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e);
Example #15
0
 internal static extern CLError clEnqueueCopyBuffer(CLCommandQueue command_queue, CLMem src_buffer, CLMem dst_buffer, SizeT src_offset, SizeT dst_offset, SizeT cb, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e);
Example #16
0
 internal static extern CLError clEnqueueWriteImage(CLCommandQueue command_queue, CLMem image, CLBool blocking_write, SizeT[] origin, SizeT[] region, SizeT input_row_pitch, SizeT input_slice_pitch, IntPtr ptr, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e);
Example #17
0
 internal static extern CLError clEnqueueCopyImageToBuffer(CLCommandQueue command_queue, CLMem src_image, CLMem dst_buffer, SizeT[] src_origin, SizeT[] region, SizeT dst_offset, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e);
Example #18
0
 internal static extern CLError clGetMemObjectInfo(CLMem memobj, CLMemInfo param_name, SizeT param_value_size, IntPtr param_value, ref SizeT param_value_size_ret);
Example #19
0
 internal static extern IntPtr clEnqueueMapBuffer(CLCommandQueue command_queue, CLMem buffer, CLBool blocking_map, CLMapFlags map_flags, SizeT offset, SizeT cb, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e, ref CLError errcode_ret);
Example #20
0
 internal static extern CLError clRetainMemObject(CLMem memobj);
Example #21
0
 internal static extern IntPtr clEnqueueMapImage(CLCommandQueue command_queue, CLMem image, CLBool blocking_map, CLMapFlags map_flags, SizeT[] origin, SizeT[] region, ref SizeT image_row_pitch, ref SizeT image_slice_pitch, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e, ref CLError errcode_ret);
Example #22
0
 internal static extern CLError clEnqueueCopyBuffer(CLCommandQueue command_queue, CLMem src_buffer, CLMem dst_buffer, SizeT src_offset, SizeT dst_offset, SizeT cb, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e);
Example #23
0
 internal static extern CLError clEnqueueReadBuffer(CLCommandQueue command_queue, CLMem buffer, CLBool blocking_read, SizeT offset, SizeT cb, IntPtr ptr, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e);
Example #24
0
 internal static extern IntPtr clEnqueueMapBuffer(CLCommandQueue command_queue, CLMem buffer, CLBool blocking_map, CLMapFlags map_flags, SizeT offset, SizeT cb, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e, ref CLError errcode_ret);
Example #25
0
 internal static extern CLError clEnqueueReadImage(CLCommandQueue command_queue, CLMem image, CLBool blocking_read, SizeT[] origin, SizeT[] region, SizeT row_pitch, SizeT slice_pitch, IntPtr ptr, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e);
Example #26
0
 internal void InitializeInternal(CLMem openclMem, SizeT sizeInternal, Context context, DeviceBufferAccess access)
 {
     this.Access = access;
     this.Context = context;
     this.openCLMem = openclMem;
     this.openCLMemSize = sizeInternal;
 }
Example #27
0
 internal static extern CLError clEnqueueUnmapMemObject(CLCommandQueue command_queue, CLMem memobj, IntPtr mapped_ptr, int num_events_in_wait_list, [In] CLEvent[] event_wait_list, ref CLEvent e);
Example #28
0
        internal override void SetAsKernelArgument(CLKernel kernel, int index)
        {
            var clMem = new CLMem
            {
                Value = openCLSampler.Value
            };

            OpenCLError.Validate(OpenCLDriver.clSetKernelArg(kernel, index, new SizeT(IntPtr.Size), ref clMem));
        }
Example #29
0
 internal static extern CLError clGetGLObjectInfo(CLMem memobj, ref int gl_object_type, ref int gl_object_name);