Method: OpenCL.enqueue_write_image

Defined in:
lib/opencl_ruby_ffi/CommandQueue.rb

.enqueue_write_image(command_queue, image, ptr, options = {}) ⇒ Object

Enqueues a command to copy from host memory into an Image

Attributes

  • command_queue - CommandQueue used to execute the write command

  • image - the Image to be written to

  • ptr - the Pointer (or convertible to Pointer using to_ptr) to the memory area to use

  • options - a hash containing named options

Options

  • :event_wait_list - if provided, a list of Event to wait upon before executing the command

  • :blocking_write - if provided indicates if the command blocks until the region is written.

  • :blocking - if provided indicates if the command blocks until the region is written

  • :origin - if provided indicates the origin of the region to write into the Image, else [0, 0, 0]

  • :region - if provided indicates the dimension of the region to copy, else the maximum region is copied

  • :input_row_pitch - if provided indicates the row pitch inside the host area, else 0

  • :input_slice_pitch - if provided indicates the slice pitch inside the host area, else 0

Returns

the Event associated with the command



743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
# File 'lib/opencl_ruby_ffi/CommandQueue.rb', line 743

def self.enqueue_write_image(command_queue, image, ptr, options = {})
  blocking = FALSE
  blocking = TRUE if options[:blocking] or options[:blocking_write]

  origin, region = get_origin_region( image, options, :origin, :region )

  input_row_pitch = 0
  input_row_pitch = options[:input_row_pitch] if options[:input_row_pitch]
  input_slice_pitch = 0
  input_slice_pitch = options[:input_slice_pitch] if options[:input_slice_pitch]
  num_events, events = get_event_wait_list( options )
  event = FFI::MemoryPointer::new( Event )
  error = clEnqueueWriteImage( command_queue, image, blocking, origin, region, input_row_pitch, input_slice_pitch, ptr, num_events, events, event )
  error_check(error)
  return Event::new(event.read_pointer, false)
end