Skip to main content

Read

Trait Read 

Source
pub trait Read {
    type Coordinates: Copy + 'static;
    type Component: Component;

    // Required method
    fn read_texel(
        &self,
        coordinates: Self::Coordinates,
        array_layer: i32,
        sample: i32,
        mip_level: i32,
    ) -> Vec4<Self::Component>;
}
Expand description

Reads one texel from a texture.

Implement this trait and then put the implementation in a Texture1d, Texture2d, etc. to provide a texture to your shader code.

Required Associated Types§

Required Methods§

Source

fn read_texel( &self, coordinates: Self::Coordinates, array_layer: i32, sample: i32, mip_level: i32, ) -> Vec4<Self::Component>

Loads a single texel from the texture.

If the coordinates are out of bounds, the implementation should not panic, but perform one of the behaviors specified in https://www.w3.org/TR/WGSL/#textureload.

Implementations on Foreign Types§

Source§

impl<T: ?Sized + Read> Read for &T

Source§

type Coordinates = <T as Read>::Coordinates

Source§

type Component = <T as Read>::Component

Source§

fn read_texel( &self, coordinates: Self::Coordinates, array_layer: i32, sample: i32, mip_level: i32, ) -> Vec4<Self::Component>

Source§

impl<T: ?Sized + Read> Read for &mut T

Source§

type Coordinates = <T as Read>::Coordinates

Source§

type Component = <T as Read>::Component

Source§

fn read_texel( &self, coordinates: Self::Coordinates, array_layer: i32, sample: i32, mip_level: i32, ) -> Vec4<Self::Component>

Implementors§