pub struct Buffer<T> { /* private fields */ }
Expand description
An OpenCL buffer.
Implements the Drop trait to call release_mem_object when the object is dropped.
Implementations§
source§impl<T> Buffer<T>
impl<T> Buffer<T>
pub fn new(buffer: cl_mem) -> Buffer<T>
sourcepub unsafe fn create(
context: &Context,
flags: cl_mem_flags,
count: size_t,
host_ptr: *mut c_void
) -> Result<Buffer<T>>
pub unsafe fn create( context: &Context, flags: cl_mem_flags, count: size_t, host_ptr: *mut c_void ) -> Result<Buffer<T>>
Create a Buffer for a context.
context
- a valid OpenCL context.flags
- a bit-field used to specify allocation and usage information about the image memory object being created, see: Memory Flags.count
- the number of T objects to be allocated.host_ptr
- a pointer to the buffer data that may already be allocated by the application.
returns a Result containing the new OpenCL buffer object or the error code from the OpenCL C API function.
sourcepub unsafe fn create_from_gl_buffer(
context: &Context,
flags: cl_mem_flags,
bufobj: cl_GLuint
) -> Result<Buffer<T>>
pub unsafe fn create_from_gl_buffer( context: &Context, flags: cl_mem_flags, bufobj: cl_GLuint ) -> Result<Buffer<T>>
Create an OpenCL buffer object for a context from an OpenGL buffer.
context
- a valid OpenCL context created from an OpenGL context.flags
- a bit-field used to specify allocation and usage information about the image memory object being created, see: Memory Flags.bufobj
- the OpenGL buffer.
returns a Result containing the new OpenCL buffer object or the error code from the OpenCL C API function.
sourcepub unsafe fn create_sub_buffer(
&self,
flags: cl_mem_flags,
origin: usize,
count: usize
) -> Result<Buffer<T>>
pub unsafe fn create_sub_buffer( &self, flags: cl_mem_flags, origin: usize, count: usize ) -> Result<Buffer<T>>
Create an new OpenCL buffer object from an existing buffer object.
See: SubBuffer Attributes.
flags
- a bit-field used to specify allocation and usage information about the sub-buffer memory object being created, see: Memory Flags.origin
- the offset in number of objects of type. count
- the size of the sub-buffer in number of objects of type.
returns a Result containing the new OpenCL buffer object or the error code from the OpenCL C API function.
Trait Implementations§
source§impl<T> ClMem for Buffer<T>
impl<T> ClMem for Buffer<T>
fn get(&self) -> cl_mem
fn get_mut(&mut self) -> cl_mem
fn mem_type(&self) -> Result<cl_mem_object_type>
fn flags(&self) -> Result<cl_mem_flags>
fn size(&self) -> Result<size_t>
fn host_ptr(&self) -> Result<intptr_t>
fn map_count(&self) -> Result<cl_uint>
fn reference_count(&self) -> Result<cl_uint>
fn context(&self) -> Result<cl_context>
fn associated_memobject(&self) -> Result<cl_mem>
fn offset(&self) -> Result<size_t>
fn uses_svm_pointer(&self) -> Result<cl_uint>
source§fn get_mem_data(&self, param_name: cl_mem_info) -> Result<Vec<u8>>
fn get_mem_data(&self, param_name: cl_mem_info) -> Result<Vec<u8>>
Get memory data about an OpenCL memory object.
Calls clGetMemObjectInfo to get the desired data about the memory object.
source§fn gl_object_info(&self) -> Result<(cl_GLuint, cl_GLuint)>
fn gl_object_info(&self) -> Result<(cl_GLuint, cl_GLuint)>
Query an OpenGL object used to create an OpenCL memory object. Read more
impl<T: Send> Send for Buffer<T>
impl<T: Sync> Sync for Buffer<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Buffer<T>where
T: RefUnwindSafe,
impl<T> Unpin for Buffer<T>where
T: Unpin,
impl<T> UnwindSafe for Buffer<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more