Struct ocl::Image

source ·
pub struct Image<T: OclPrm> { /* private fields */ }
Expand description

A section of device memory which represents one or many images.

Use ::builder for an easy way to create. [UNIMPLEMENTED]

Implementations§

source§

impl<T: OclPrm> Image<T>

source

pub fn supported_formats( context: &Context, flags: MemFlags, mem_obj_type: MemObjectType ) -> OclResult<Vec<ImageFormatParseResult>>

Returns a list of supported image formats.

source

pub fn builder<'a>() -> ImageBuilder<'a, T>

Returns an ImageBuilder. This is the recommended method to create a new Image.

source

pub unsafe fn new<'o, Q>( que_ctx: Q, flags: MemFlags, image_format: ImageFormat, image_desc: ImageDescriptor, host_data: Option<&[T]> ) -> OclResult<Image<T>>
where Q: Into<QueCtx<'o>>,

Returns a new Image.

Prefer ::builder to create a new image.

source

pub fn from_gl_texture<'o, Q>( que_ctx: Q, flags: MemFlags, image_desc: ImageDescriptor, texture_target: GlTextureTarget, miplevel: cl_GLint, texture: cl_GLuint ) -> OclResult<Image<T>>
where Q: Into<QueCtx<'o>>,

Returns a new Image from an existant GL texture2D/3D.

Remember to specify the GL context when creating the CL context, using .properties(ocl_interop::get_properties_list())

Don’t forget to .cmd().gl_acquire().enq() before using it and .cmd().gl_release().enq() after.

source

pub fn from_gl_renderbuffer<'o, Q>( que_ctx: Q, flags: MemFlags, image_desc: ImageDescriptor, renderbuffer: cl_GLuint ) -> OclResult<Image<T>>
where Q: Into<QueCtx<'o>>,

Returns a new Image from an existant renderbuffer.

Remember to specify the GL context when creating the CL context, using .properties(ocl_interop::get_properties_list())

Don’t forget to .cmd().gl_acquire().enq() before using it and .cmd().gl_release().enq() after.

source

pub fn from_d3d11_texture2d<'o, Q>( que_ctx: Q, flags: MemFlags, image_desc: ImageDescriptor, texture: cl_id3d11_texture2d, subresource: u32 ) -> OclResult<Image<T>>
where Q: Into<QueCtx<'o>>,

Returns a new Image from an existant ID3D11Texture2D.

Remember to specify the D3D11 device when creating the CL context, using .properties() and .set_property_value(ContextPropertyValue::D3d11DeviceKhr(<pointer to ID3D11Device>))

Don’t forget to .cmd().d3d11_acquire().enq() before using it and .cmd().d3d11_release().enq() after.

source

pub fn from_d3d11_texture3d<'o, Q>( que_ctx: Q, flags: MemFlags, image_desc: ImageDescriptor, texture: cl_id3d11_texture3d, subresource: u32 ) -> OclResult<Image<T>>
where Q: Into<QueCtx<'o>>,

Returns a new Image from an existant ID3D11Texture2D.

Remember to specify the D3D11 device when creating the CL context, using .properties() and .set_property_value(ContextPropertyValue::D3d11DeviceKhr(<pointer to ID3D11Device>))

Don’t forget to .cmd().d3d11_acquire().enq() before using it and .cmd().d3d11_release().enq() after.

source

pub fn cmd(&self) -> ImageCmd<'_, T>

Returns an image command builder used to read, write, copy, etc.

Call .enq() to enqueue the command.

See the command builder documentation for more details.

source

pub fn read<'c, 'd>(&'c self, data: &'d mut [T]) -> ImageCmd<'c, T>
where 'd: 'c,

Returns an image command builder set to read.

Call .enq() to enqueue the command.

See the command builder documentation for more details.

source

pub fn write<'c, 'd>(&'c self, data: &'d [T]) -> ImageCmd<'c, T>
where 'd: 'c,

Returns an image command builder set to write.

Call .enq() to enqueue the command.

See the command builder documentation for more details.

source

pub unsafe fn map<'c>(&'c self) -> ImageMapCmd<'c, T>

Returns a command builder used to map data for reading or writing.

Call .enq() to enqueue the command.

§Safety

The caller must ensure that only one mapping of a particular memory region exists at a time.

See the command builder documentation for more details.

source

pub fn set_default_queue<'a>(&'a mut self, queue: Queue) -> &'a mut Image<T>

Changes the default queue.

Returns a ref for chaining i.e.:

image.set_default_queue(queue).write(....);

[NOTE]: Even when used as above, the queue is changed permanently, not just for the one call. Changing the queue is cheap so feel free to change as often as needed.

The new queue must be associated with a valid device.

source

pub fn default_queue(&self) -> Option<&Queue>

Returns a reference to the default queue.

source

pub fn dims(&self) -> &SpatialDims

Returns this image’s dimensions.

source

pub fn pixel_count(&self) -> usize

Returns the total number of pixels in this image.

source

pub fn pixel_element_len(&self) -> usize

Returns the length of each pixel element.

source

pub fn element_count(&self) -> usize

Returns the total number of pixel elements in this image. Equivalent to its length.

source

pub fn info(&self, info_kind: ImageInfo) -> OclResult<ImageInfoResult>

Get information about this image.

source

pub fn mem_info(&self, info_kind: MemInfo) -> OclResult<MemInfoResult>

Returns info about this image’s memory.

source

pub fn as_core(&self) -> &MemCore

Returns a reference to the core pointer wrapper, usable by functions in the core module.

Methods from Deref<Target = MemCore>§

source

pub fn as_ptr(&self) -> *mut c_void

Returns a pointer, do not store it.

Trait Implementations§

source§

impl<T: OclPrm> AsMem<T> for Image<T>

source§

fn as_mem(&self) -> &MemCore

source§

impl<T: Clone + OclPrm> Clone for Image<T>

source§

fn clone(&self) -> Image<T>

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<T: Debug + OclPrm> Debug for Image<T>

source§

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

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

impl<T: OclPrm> Deref for Image<T>

§

type Target = Mem

The resulting type after dereferencing.
source§

fn deref(&self) -> &MemCore

Dereferences the value.
source§

impl<T: OclPrm> DerefMut for Image<T>

source§

fn deref_mut(&mut self) -> &mut MemCore

Mutably dereferences the value.
source§

impl<T: OclPrm> Display for Image<T>

source§

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

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

impl<'a, T> MemCmdAll for &'a Image<T>
where T: OclPrm,

source§

impl<'a, T> MemCmdAll for &'a mut Image<T>
where T: OclPrm,

source§

impl<'a, T> MemCmdAll for Image<T>
where T: OclPrm,

source§

impl<'a, T> MemCmdRw for &'a Image<T>
where T: OclPrm,

source§

impl<'a, T> MemCmdRw for &'a mut Image<T>
where T: OclPrm,

source§

impl<'a, T> MemCmdRw for Image<T>
where T: OclPrm,

Auto Trait Implementations§

§

impl<T> Freeze for Image<T>

§

impl<T> RefUnwindSafe for Image<T>
where T: RefUnwindSafe,

§

impl<T> Send for Image<T>

§

impl<T> Sync for Image<T>

§

impl<T> Unpin for Image<T>
where T: Unpin,

§

impl<T> UnwindSafe for Image<T>
where T: UnwindSafe,

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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

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

Initializes a with the given initializer. Read more
source§

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

Dereferences the given pointer. Read more
source§

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

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

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

impl<T> ToOwned for T
where 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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.