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 const fn new(buffer: cl_mem) -> Self
Sourcepub unsafe fn create(
context: &Context,
flags: cl_mem_flags,
count: size_t,
host_ptr: *mut c_void,
) -> Result<Self>
pub unsafe fn create( context: &Context, flags: cl_mem_flags, count: size_t, host_ptr: *mut c_void, ) -> Result<Self>
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_with_properties(
context: &Context,
properties: *const cl_mem_properties,
flags: cl_mem_flags,
count: size_t,
host_ptr: *mut c_void,
) -> Result<Self>
pub unsafe fn create_with_properties( context: &Context, properties: *const cl_mem_properties, flags: cl_mem_flags, count: size_t, host_ptr: *mut c_void, ) -> Result<Self>
Create an OpenCL buffer object for a context.
CL_VERSION_3_0
context
- a valid OpenCL context.properties
- an optional null terminated list of properties.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<Self>
pub unsafe fn create_from_gl_buffer( context: &Context, flags: cl_mem_flags, bufobj: cl_GLuint, ) -> Result<Self>
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.
pub unsafe fn create_with_properties_intel( context: &Context, properties: *const cl_mem_properties_intel, flags: cl_mem_flags, count: size_t, host_ptr: *mut c_void, ) -> Result<Self>
Sourcepub unsafe fn create_sub_buffer(
&self,
flags: cl_mem_flags,
origin: usize,
count: usize,
) -> Result<Self>
pub unsafe fn create_sub_buffer( &self, flags: cl_mem_flags, origin: usize, count: usize, ) -> Result<Self>
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 typeT
.count
- the size of the sub-buffer in number of objects of typeT
.
returns a Result containing the new OpenCL buffer object or the error code from the OpenCL C API function.