Module: OpenCL::Mem::OpenCL11
- Included in:
- OpenCL::Mem
- Defined in:
- lib/opencl_ruby_ffi/Mem.rb
Instance Method Summary collapse
-
#associated_memobject ⇒ Object
Returns the Buffer this Buffer was created from using create_sub_buffer.
-
#offset ⇒ Object
Returns the OpenCL::Mem::offset info.
-
#set_destructor_callback(options = {}, &proc) ⇒ Object
Attaches a callback to memobj that will be called on the memobj destruction.
Instance Method Details
#associated_memobject ⇒ Object
Returns the Buffer this Buffer was created from using create_sub_buffer
104 105 106 107 108 109 110 |
# File 'lib/opencl_ruby_ffi/Mem.rb', line 104 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 |
#offset ⇒ Object
Returns the OpenCL::Mem::offset info
101 |
# File 'lib/opencl_ruby_ffi/Mem.rb', line 101 get_info("Mem", :size_t, "offset", true) |
#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
122 123 124 125 |
# File 'lib/opencl_ruby_ffi/Mem.rb', line 122 def set_destructor_callback( = {}, &proc ) OpenCL.set_mem_object_destructor_callback( self, , &proc ) return self end |