Struct ocl::async::BufferSink
source · pub struct BufferSink<T: OclPrm> { /* private fields */ }
Expand description
Represents mapped memory and allows frames of data to be ‘flushed’ (written) from host-accessible mapped memory region into its associated device-visible buffer in a repeated fashion.
This represents the fastest possible method for continuously writing frames of data to a device.
Implementations§
source§impl<T: OclPrm> BufferSink<T>
impl<T: OclPrm> BufferSink<T>
sourcepub fn new(queue: Queue, len: usize) -> OclResult<BufferSink<T>>
pub fn new(queue: Queue, len: usize) -> OclResult<BufferSink<T>>
Returns a new BufferSink
.
The current thread will be blocked while the buffer is initialized upon calling this function.
sourcepub unsafe fn from_buffer(
buffer: Buffer<T>,
queue: Option<Queue>,
default_offset: usize,
default_len: usize
) -> OclResult<BufferSink<T>>
pub unsafe fn from_buffer( buffer: Buffer<T>, queue: Option<Queue>, default_offset: usize, default_len: usize ) -> OclResult<BufferSink<T>>
sourcepub fn read(self) -> FutureGuard<Inner<T>, ReadGuard<Inner<T>>>
pub fn read(self) -> FutureGuard<Inner<T>, ReadGuard<Inner<T>>>
Returns a new FutureGuard
which will resolve into a a ReadGuard
.
sourcepub fn write(self) -> FutureGuard<Inner<T>, WriteGuard<Inner<T>>>
pub fn write(self) -> FutureGuard<Inner<T>, WriteGuard<Inner<T>>>
Returns a new FutureGuard
which will resolve into a a WriteGuard
.
sourcepub fn flush<'c>(self) -> FlushCmd<'c, T>
pub fn flush<'c>(self) -> FlushCmd<'c, T>
Returns a command builder which, once enqueued, will flush data from the mapped memory region to the device.
sourcepub fn memory(&self) -> &MemMapCore<T>
pub fn memory(&self) -> &MemMapCore<T>
Returns a reference to the internal memory mapping.
sourcepub fn default_offset(&self) -> usize
pub fn default_offset(&self) -> usize
Returns a reference to the internal offset.
sourcepub fn default_len(&self) -> usize
pub fn default_len(&self) -> usize
Returns the length of the memory region.
sourcepub unsafe fn as_mut_slice(&mut self) -> &mut [T]
pub unsafe fn as_mut_slice(&mut self) -> &mut [T]
Returns a mutable slice into the contained memory region.
Used by buffer command builders when preparing future read and write commands.
Do not use unless you are 100% certain that there will be no other reads or writes for the entire access duration (only possible if manually manipulating the lock status).
Trait Implementations§
source§impl<T: Clone + OclPrm> Clone for BufferSink<T>
impl<T: Clone + OclPrm> Clone for BufferSink<T>
source§fn clone(&self) -> BufferSink<T>
fn clone(&self) -> BufferSink<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more