Module: OpenCL::Mem::OpenCL11

Included in:
OpenCL::Mem
Defined in:
lib/opencl_ruby_ffi/Mem.rb

Instance Method Summary collapse

Instance Method Details

#associated_memobjectObject

Returns the Buffer this Buffer was created from using create_sub_buffer



94
95
96
97
98
99
100
# File 'lib/opencl_ruby_ffi/Mem.rb', line 94

def associated_memobject
  ptr = MemoryPointer::new( Mem )
  error = OpenCL.clGetMemObjectInfo(self, ASSOCIATED_MEMOBJECT, Mem.size, ptr, nil)
  error_check(error)
  return nil if ptr.read_pointer.null?
  return Mem::new( ptr.read_pointer )
end

#offsetObject

Returns the OpenCL::Mem::offset info

Returns:

  • size_t



91
# File 'lib/opencl_ruby_ffi/Mem.rb', line 91

get_info("Mem", :size_t, "offset")

#set_destructor_callback(options = {}, &proc) ⇒ Object

Attaches a callback to memobj that will be called on the memobj destruction

Attributes

  • options - a hash containing named options

  • block - if provided, a callback invoked when memobj is released. Signature of the callback is { |Mem, Pointer to user_data| … }

Options

  • :user_data - a Pointer (or convertible to Pointer using to_ptr) to the memory area to pass to the callback



112
113
114
115
# File 'lib/opencl_ruby_ffi/Mem.rb', line 112

def set_destructor_callback( options = {}, &proc )
  OpenCL.set_mem_object_destructor_callback( self, options, &proc )
  return self
end