Struct Image

Source
pub struct Image { /* private fields */ }
Expand description

An OpenCL image.

Has methods to return information from calls to clGetImageInfo with the appropriate parameters.
Implements the Drop trait to call release_mem_object when the object is dropped.

Implementations§

Source§

impl Image

Source

pub const fn new(image: cl_mem) -> Self

Source

pub unsafe fn create( context: &Context, flags: cl_mem_flags, image_format: *const cl_image_format, image_desc: *const cl_image_desc, host_ptr: *mut c_void, ) -> Result<Self>

Create an OpenCL image object 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.
  • image_format - a pointer to a structure that describes format properties of the image to be allocated.
  • image_desc - a pointer to a structure that describes type and dimensions of the image to be allocated.
  • host_ptr - a pointer to the image data that may already be allocated by the application.

returns a Result containing the new OpenCL image object or the error code from the OpenCL C API function.

Source

pub unsafe fn create_with_properties( context: &Context, properties: *const cl_mem_properties, flags: cl_mem_flags, image_format: *const cl_image_format, image_desc: *const cl_image_desc, host_ptr: *mut c_void, ) -> Result<Self>

Create an OpenCL image 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.
  • image_format - a pointer to a structure that describes format properties of the image to be allocated.
  • image_desc - a pointer to a structure that describes type and dimensions of the image to be allocated.
  • host_ptr - a pointer to the image data that may already be allocated by the application.

returns a Result containing the new OpenCL image object or the error code from the OpenCL C API function.

Source

pub unsafe fn create_from_gl_texture( context: &Context, flags: cl_mem_flags, texture_target: cl_GLenum, miplevel: cl_GLint, texture: cl_GLuint, ) -> Result<Self>

Create an OpenCL image object, image array object, or image buffer object for a context.

From an OpenGL: texture object, texture array object, texture buffer object, or a single face of an OpenGL cubemap texture object.

  • 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.
  • texture_target - used to define the image type of texture.
  • miplevel - used to define the mipmap level.
  • texture - the name of a GL buffer texture object.

returns a Result containing the new OpenCL image object or the error code from the OpenCL C API function.

Source

pub unsafe fn create_from_gl_render_buffer( context: &Context, flags: cl_mem_flags, renderbuffer: cl_GLuint, ) -> Result<Self>

Create an OpenCL 2D image object from an OpenGL renderbuffer object.

  • 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.
  • renderbuffer - a GL renderbuffer object.

returns a Result containing the new OpenCL image object or the error code from the OpenCL C API function.

Source

pub unsafe fn create_from_egl_image( context: &Context, display: CLeglDisplayKHR, image: CLeglImageKHR, flags: cl_mem_flags, properties: &[cl_egl_image_properties_khr], ) -> Result<Self>

Create an OpenCL image object, from the EGLImage source provided as image.
Requires the cl_khr_egl_image extension.

  • context - a valid OpenCL context created from an OpenGL context.
  • display - should be of type EGLDisplay, cast into the type CLeglDisplayKHR
  • image - should be of type EGLImageKHR, cast into the type CLeglImageKHR.
  • flags - usage information about the memory object being created.
  • properties - a null terminated list of property names and their corresponding values.

returns a Result containing the new OpenCL image object or the error code from the OpenCL C API function.

Source

pub unsafe fn create_from_dx9_media_surface_intel( context: &Context, flags: cl_mem_flags, resource: IDirect3DSurface9_ptr, shared_handle: HANDLE, plane: cl_uint, ) -> Result<Self>

Source

pub fn format(&self) -> Result<Vec<cl_image_format>>

Source

pub fn element_size(&self) -> Result<size_t>

Source

pub fn row_pitch(&self) -> Result<size_t>

Source

pub fn slice_pitch(&self) -> Result<size_t>

Source

pub fn width(&self) -> Result<size_t>

Source

pub fn height(&self) -> Result<size_t>

Source

pub fn depth(&self) -> Result<size_t>

Source

pub fn array_size(&self) -> Result<size_t>

Source

pub fn buffer(&self) -> Result<cl_mem>

Source

pub fn num_mip_levels(&self) -> Result<cl_uint>

Source

pub fn num_samples(&self) -> Result<cl_uint>

Source

pub fn get_data(&self, param_name: cl_image_info) -> Result<Vec<u8>>

Get data about an OpenCL image object. Calls clGetImageInfo to get the desired data about the image object.

Source

pub fn gl_texture_target(&self) -> Result<cl_uint>

Get information about the GL texture target associated with a memory object.

Source

pub fn gl_mipmap_level(&self) -> Result<cl_int>

Get information about the GL mipmap level associated with a memory object.

Source

pub fn gl_num_samples(&self) -> Result<cl_int>

Get information about the GL number of samples associated with a memory object.

Source

pub fn get_gl_texture_data( &self, param_name: cl_gl_texture_info, ) -> Result<Vec<u8>>

Get GL texture information associated with a memory object.

Trait Implementations§

Source§

impl ClMem for Image

Source§

fn get(&self) -> cl_mem

Source§

fn get_mut(&mut self) -> cl_mem

Source§

fn mem_type(&self) -> Result<cl_mem_object_type>

Source§

fn flags(&self) -> Result<cl_mem_flags>

Source§

fn size(&self) -> Result<size_t>

Source§

fn host_ptr(&self) -> Result<intptr_t>

Source§

fn map_count(&self) -> Result<cl_uint>

Source§

fn reference_count(&self) -> Result<cl_uint>

Source§

fn context(&self) -> Result<cl_context>

Source§

fn associated_memobject(&self) -> Result<cl_mem>

Source§

fn offset(&self) -> Result<size_t>

Source§

fn uses_svm_pointer(&self) -> Result<cl_uint>

Source§

fn properties(&self) -> Result<Vec<cl_ulong>>

CL_VERSION_3_0
Source§

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)>

Query an OpenGL object used to create an OpenCL memory object. Read more
Source§

impl Debug for Image

Source§

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

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

impl Drop for Image

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<Image> for cl_mem

Source§

fn from(value: Image) -> Self

Converts to this type from the input type.
Source§

impl Send for Image

Auto Trait Implementations§

§

impl Freeze for Image

§

impl RefUnwindSafe for Image

§

impl !Sync for Image

§

impl Unpin for Image

§

impl UnwindSafe for Image

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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.

Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.