Struct blaze_rs::buffer::RawBuffer

source ·
#[repr(transparent)]
pub struct RawBuffer(_);
Expand description

A raw OpenCL buffer

Implementations§

source§

impl RawBuffer

source

pub fn new( size: usize, flags: MemFlags, host_ptr: Option<NonNull<c_void>> ) -> Result<Self>

source

pub fn new_in( ctx: &RawContext, size: usize, flags: MemFlags, host_ptr: Option<NonNull<c_void>> ) -> Result<Self>

source

pub const unsafe fn from_mem(mem: RawMemObject) -> Self

source

pub const unsafe fn from_id_unchecked(id: cl_mem) -> Self

source

pub unsafe fn from_id(id: cl_mem) -> Option<Self>

source

pub unsafe fn create_sub_buffer( &self, flags: MemAccess, region: BufferRange ) -> Result<RawBuffer>

Available on crate feature cl1_1 only.

Creates a new buffer object (referred to as a sub-buffer object) from an existing buffer object.

source§

impl RawBuffer

source

pub unsafe fn read_to_ptr( &self, range: BufferRange, dst: *mut c_void, wait: WaitList<'_> ) -> Result<RawEvent>

source

pub unsafe fn read_rect_to_ptr( &self, buffer_origin: [usize; 3], host_origin: [usize; 3], region: [usize; 3], buffer_row_pitch: Option<usize>, buffer_slice_pitch: Option<usize>, host_row_pitch: Option<usize>, host_slice_pitch: Option<usize>, dst: *mut c_void, wait: WaitList<'_> ) -> Result<RawEvent>

Available on crate feature cl1_1 only.
source

pub unsafe fn write_from_ptr( &mut self, range: BufferRange, src: *const c_void, wait: WaitList<'_> ) -> Result<RawEvent>

source

pub unsafe fn write_rect_from_ptr( &mut self, buffer_origin: [usize; 3], host_origin: [usize; 3], region: [usize; 3], buffer_row_pitch: Option<usize>, buffer_slice_pitch: Option<usize>, host_row_pitch: Option<usize>, host_slice_pitch: Option<usize>, src: *const c_void, wait: WaitList<'_> ) -> Result<RawEvent>

Available on crate feature cl1_1 only.
source

pub unsafe fn copy_from( &mut self, dst_offset: usize, src: &RawBuffer, src_offset: usize, size: usize, wait: WaitList<'_> ) -> Result<RawEvent>

source

pub unsafe fn fill_raw<T: Copy>( &mut self, v: T, range: BufferRange, wait: WaitList<'_> ) -> Result<RawEvent>

Available on crate feature cl1_2 only.
source

pub unsafe fn map_read( &self, range: BufferRange, wait: WaitList<'_> ) -> Result<(*const c_void, RawEvent)>

source

pub unsafe fn map_write( &self, range: BufferRange, wait: WaitList<'_> ) -> Result<(*mut c_void, RawEvent)>

source

pub unsafe fn map_read_write( &self, range: BufferRange, wait: WaitList<'_> ) -> Result<(*mut c_void, RawEvent)>

source§

impl RawBuffer

source

pub unsafe fn read_to_ptr_in( &self, range: BufferRange, dst: *mut c_void, queue: &RawCommandQueue, wait: WaitList<'_> ) -> Result<RawEvent>

Reads the contents of this

source

pub unsafe fn read_rect_to_ptr_in( &self, buffer_origin: [usize; 3], host_origin: [usize; 3], region: [usize; 3], buffer_row_pitch: Option<usize>, buffer_slice_pitch: Option<usize>, host_row_pitch: Option<usize>, host_slice_pitch: Option<usize>, dst: *mut c_void, queue: &RawCommandQueue, wait: WaitList<'_> ) -> Result<RawEvent>

Available on crate feature cl1_1 only.
source

pub unsafe fn write_from_ptr_in( &mut self, range: BufferRange, src: *const c_void, queue: &RawCommandQueue, wait: WaitList<'_> ) -> Result<RawEvent>

source

pub unsafe fn write_rect_from_ptr_in( &mut self, buffer_origin: [usize; 3], host_origin: [usize; 3], region: [usize; 3], buffer_row_pitch: Option<usize>, buffer_slice_pitch: Option<usize>, host_row_pitch: Option<usize>, host_slice_pitch: Option<usize>, src: *const c_void, queue: &RawCommandQueue, wait: WaitList<'_> ) -> Result<RawEvent>

Available on crate feature cl1_1 only.
source

pub unsafe fn copy_from_in( &mut self, dst_offset: usize, src: &RawBuffer, src_offset: usize, size: usize, queue: &RawCommandQueue, wait: WaitList<'_> ) -> Result<RawEvent>

source

pub unsafe fn copy_from_rect_raw_in( &mut self, dst_origin: [usize; 3], src_origin: [usize; 3], region: [usize; 3], dst_row_pitch: Option<usize>, dst_slice_pitch: Option<usize>, src_row_pitch: Option<usize>, src_slice_pitch: Option<usize>, src: &RawBuffer, queue: &RawCommandQueue, wait: WaitList<'_> ) -> Result<RawEvent>

Available on crate feature cl1_1 only.
source

pub unsafe fn fill_raw_in<T>( &mut self, v: T, range: BufferRange, queue: &RawCommandQueue, wait: WaitList<'_> ) -> Result<RawEvent>

Available on crate feature cl1_2 only.
source

pub unsafe fn map_read_in( &self, range: BufferRange, queue: &RawCommandQueue, wait: WaitList<'_> ) -> Result<(*const c_void, RawEvent)>

source

pub unsafe fn map_write_in( &self, range: BufferRange, queue: &RawCommandQueue, wait: WaitList<'_> ) -> Result<(*mut c_void, RawEvent)>

source

pub unsafe fn map_read_write_in( &self, range: BufferRange, queue: &RawCommandQueue, wait: WaitList<'_> ) -> Result<(*mut c_void, RawEvent)>

Methods from Deref<Target = RawMemObject>§

source

pub unsafe fn retain(&self) -> Result<()>

source

pub fn id(&self) -> cl_mem

source

pub fn id_ref(&self) -> &cl_mem

source

pub fn id_ref_mut(&mut self) -> &mut cl_mem

source

pub fn ty(&self) -> Result<MemObjectType>

Returns the memory obejct’s type

source

pub fn associated_memobject(&self) -> Result<Option<RawMemObject>>

Available on crate feature cl1_1 only.

Return memory object from which memobj is created.

source

pub fn flags(&self) -> Result<MemFlags>

Return the flags argument value specified when memobj is created.

source

pub fn size(&self) -> Result<usize>

Return actual size of the data store associated with memobj in bytes.

source

pub fn host_ptr(&self) -> Result<Option<NonNull<c_void>>>

If memobj is created with a host_ptr specified, return the host_ptr argument value specified when memobj is created.

source

pub fn map_count(&self) -> Result<u32>

Map count. The map count returned should be considered immediately stale. It is unsuitable for general use in applications. This feature is provided for debugging.

source

pub fn reference_count(&self) -> Result<u32>

Return memobj reference count. The reference count returned should be considered immediately stale. It is unsuitable for general use in applications. This feature is provided for identifying memory leaks.

source

pub fn context(&self) -> Result<RawContext>

Return context specified when memory object is created.

source

pub fn offset(&self) -> Result<usize>

Available on crate feature cl1_1 only.

Return offset if memobj is a sub-buffer object created using create_sub_buffer. Returns 0 if memobj is not a subbuffer object.

source

pub fn uses_svm_pointer(&self) -> Result<bool>

Available on crate feature cl2 only.

Return true if memobj is a buffer object that was created with CL_MEM_USE_HOST_PTR or is a sub-buffer object of a buffer object that was created with CL_MEM_USE_HOST_PTR and the host_ptr specified when the buffer object was created is a SVM pointer; otherwise returns false.

source

pub fn on_destruct(&self, f: impl 'static + FnOnce() + Send) -> Result<()>

Available on crate feature cl1_1 only.

Adds a callback to be executed when the memory object is destructed by OpenCL.

source

pub fn on_destruct_boxed(&self, f: Box<dyn FnOnce() + Send>) -> Result<()>

Available on crate feature cl1_1 only.
source

pub unsafe fn on_destruct_raw( &self, f: unsafe extern "C" fn(memobj: cl_mem, user_data: *mut c_void), user_data: *mut c_void ) -> Result<()>

Available on crate feature cl1_1 only.

Trait Implementations§

source§

impl Clone for RawBuffer

source§

fn clone(&self) -> RawBuffer

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RawBuffer

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Deref for RawBuffer

§

type Target = RawMemObject

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl DerefMut for RawBuffer

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl Hash for RawBuffer

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Into<RawMemObject> for RawBuffer

source§

fn into(self) -> RawMemObject

Converts this type into the (usually inferred) input type.
source§

impl PartialEq<RawBuffer> for RawBuffer

source§

fn eq(&self, other: &RawBuffer) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for RawBuffer

source§

impl StructuralEq for RawBuffer

source§

impl StructuralPartialEq for RawBuffer

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> AsMem for Twhere T: Deref<Target = impl AsMem + 'static>,

source§

impl<T> AsMutMem for Twhere T: DerefMut<Target = impl AsMutMem + 'static>,

source§

fn as_mut_mem(&mut self) -> &mut RawMemObject

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.