Method: OpenCL.create_buffer
- Defined in:
- lib/opencl_ruby_ffi/Buffer.rb
.create_buffer(context, size, options = {}) ⇒ Object
Creates a Buffer
Attributes
-
context- Context the created Buffer will be associated to -
size- size of the Buffer to be created -
options- a hash containing named options
Options
-
:flags- a single or an Array of :cl_mem_flags specifying the flags to be used when creating the Buffer -
:host_ptr- if provided, the Pointer (or convertible to Pointer using to_ptr) to the memory area to use -
:properties- if provided, an array of :cl_mem_properties (OpenCL 3.0)
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/opencl_ruby_ffi/Buffer.rb', line 17 def self.create_buffer( context, size, = {} ) flags = get_flags( ) host_ptr = [:host_ptr] error = MemoryPointer::new( :cl_int ) if context.platform.version_number < 3.0 then buff = clCreateBuffer(context, flags, size, host_ptr, error) else properties = get_mem_properties( ) buff = clCreateBufferWithProperties(context, properties, flags, size, host_ptr, error) end error_check(error.read_cl_int) return Buffer::new( buff, false ) end |