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
impl Image
pub const fn new(image: cl_mem) -> Self
Sourcepub 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>
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.
Sourcepub 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>
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.
Sourcepub unsafe fn create_from_gl_texture(
context: &Context,
flags: cl_mem_flags,
texture_target: cl_GLenum,
miplevel: cl_GLint,
texture: cl_GLuint,
) -> Result<Self>
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.
Sourcepub unsafe fn create_from_gl_render_buffer(
context: &Context,
flags: cl_mem_flags,
renderbuffer: cl_GLuint,
) -> Result<Self>
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.
Sourcepub unsafe fn create_from_egl_image(
context: &Context,
display: CLeglDisplayKHR,
image: CLeglImageKHR,
flags: cl_mem_flags,
properties: &[cl_egl_image_properties_khr],
) -> Result<Self>
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 CLeglDisplayKHRimage
- 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.
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>
pub fn format(&self) -> Result<Vec<cl_image_format>>
pub fn element_size(&self) -> Result<size_t>
pub fn row_pitch(&self) -> Result<size_t>
pub fn slice_pitch(&self) -> Result<size_t>
pub fn width(&self) -> Result<size_t>
pub fn height(&self) -> Result<size_t>
pub fn depth(&self) -> Result<size_t>
pub fn array_size(&self) -> Result<size_t>
pub fn buffer(&self) -> Result<cl_mem>
pub fn num_mip_levels(&self) -> Result<cl_uint>
pub fn num_samples(&self) -> Result<cl_uint>
Sourcepub fn get_data(&self, param_name: cl_image_info) -> Result<Vec<u8>>
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.
Sourcepub fn gl_texture_target(&self) -> Result<cl_uint>
pub fn gl_texture_target(&self) -> Result<cl_uint>
Get information about the GL texture target associated with a memory object.
Sourcepub fn gl_mipmap_level(&self) -> Result<cl_int>
pub fn gl_mipmap_level(&self) -> Result<cl_int>
Get information about the GL mipmap level associated with a memory object.
Sourcepub fn gl_num_samples(&self) -> Result<cl_int>
pub fn gl_num_samples(&self) -> Result<cl_int>
Get information about the GL number of samples associated with a memory object.
Sourcepub fn get_gl_texture_data(
&self,
param_name: cl_gl_texture_info,
) -> Result<Vec<u8>>
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.