Struct ocl::Buffer
[−]
[src]
pub struct Buffer<T: OclPrm> { /* fields omitted */ }A chunk of memory physically located on a device, such as a GPU.
Data is stored remotely in a memory buffer on the device associated with
queue.
Methods
impl<T: OclPrm> Buffer<T>[src]
fn new<D: Into<SpatialDims>>(queue: Queue,
flags: Option<MemFlags>,
dims: D,
data: Option<&[T]>)
-> OclResult<Buffer<T>>
flags: Option<MemFlags>,
dims: D,
data: Option<&[T]>)
-> OclResult<Buffer<T>>
Creates a new buffer.
flags defaults to flags::MEM_READ_WRITE if None is passed. See
the SDK Docs for more information about flags. Note that the
host_ptr mentioned in the SDK Docs is equivalent to the slice
optionally passed as the data argument. Also note that the names of
the flags in this library have the CL_ prefix removed for brevity.
[UNSTABLE]: Arguments may still be in a state of flux.
fn from_gl_buffer<D: MemLen>(queue: &Queue,
flags: Option<MemFlags>,
dims: D,
gl_object: cl_GLuint)
-> OclResult<Buffer<T>>
flags: Option<MemFlags>,
dims: D,
gl_object: cl_GLuint)
-> OclResult<Buffer<T>>
[UNTESTED] Creates a buffer linked to a previously created OpenGL buffer object.
Errors
Don't forget to .cmd().gl_acquire().enq() before using it and
.cmd().gl_release().enq() after.
See the BufferCmd docs
for more info.
fn cmd(&self) -> BufferCmd<T>
Returns a buffer command builder used to read, write, copy, etc.
Call .enq() to enqueue the command.
See the BufferCmd docs
for more info.
fn read<'b>(&'b self, data: &'b mut [T]) -> BufferCmd<'b, T>
Returns a buffer command builder used to read.
Call .enq() to enqueue the command.
See the BufferCmd docs
for more info.
fn write<'b>(&'b self, data: &'b [T]) -> BufferCmd<'b, T>
Returns a buffer command builder used to write.
Call .enq() to enqueue the command.
See the BufferCmd docs
for more info.
fn len(&self) -> usize
Returns the length of the buffer.
fn dims(&self) -> &SpatialDims
Returns the dimensions of the buffer.
fn is_empty(&self) -> bool
Returns if the Buffer is empty.
fn mem_info(&self, info_kind: MemInfo) -> MemInfoResult
Returns info about the underlying memory object.
fn set_default_queue<'a>(&'a mut self, queue: &Queue) -> &'a mut Buffer<T>
Changes the default queue used by this Buffer for reads and writes, etc.
Returns a mutable reference for optional chaining i.e.:
Example
buffer.set_default_queue(queue).read(....);
fn default_queue(&self) -> &Queue
Returns a reference to the default queue.
fn core_as_ref(&self) -> &MemCore
Returns a reference to the core pointer wrapper, usable by functions in
the core module.
Methods from Deref<Target=MemCore>
Trait Implementations
impl<T: Debug + OclPrm> Debug for Buffer<T>[src]
impl<T: Clone + OclPrm> Clone for Buffer<T>[src]
fn clone(&self) -> Buffer<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more
impl<T: OclPrm> Deref for Buffer<T>[src]
type Target = MemCore
The resulting type after dereferencing
fn deref(&self) -> &MemCore
The method called to dereference a value