Struct spirv_std::image::Image

source ·
pub struct Image<SampledType: SampleType<FORMAT>, const DIM: u32, const DEPTH: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32, const FORMAT: u32> { /* private fields */ }
Expand description

An opaque image type. Corresponds to OpTypeImage.

You likely want to write this type using the crate::Image! macro helper, as the generic arguments here can get extremely verbose.

See SPIR-V OpTypeImage specification for the meaning of integer parameters.

Implementations§

source§

impl<SampledType: SampleType<FORMAT>, const DIM: u32, const DEPTH: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const FORMAT: u32> Image<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, { _ }, FORMAT>

source

pub fn fetch<I>( &self, coordinate: impl ImageCoordinate<I, DIM, ARRAYED> ) -> SampledType::Vec4where I: Integer,

Fetch a single texel with a sampler set at compile time

source§

impl<SampledType: SampleType<FORMAT>, const DIM: u32, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const SAMPLED: u32> Image<SampledType, DIM, DEPTH, ARRAYED, { _ }, SAMPLED, FORMAT>

source

pub fn gather<F>( &self, sampler: Sampler, coordinate: impl ImageCoordinate<F, DIM, ARRAYED>, component: u32 ) -> SampledType::Vec4where Self: HasGather, F: Float,

Gathers the requested component from four texels.

source

pub fn sample<F>( &self, sampler: Sampler, coord: impl ImageCoordinate<F, DIM, ARRAYED> ) -> SampledType::Vec4where F: Float,

Sample texels at coord from the image using sampler.

source

pub fn sample_bias<F>( &self, sampler: Sampler, coord: impl ImageCoordinate<F, DIM, ARRAYED>, bias: f32 ) -> SampledType::Vec4where F: Float,

Sample texels at coord from the image using sampler, after adding the input bias to the implicit level of detail.

source

pub fn sample_by_lod<F>( &self, sampler: Sampler, coordinate: impl ImageCoordinate<F, DIM, ARRAYED>, lod: f32 ) -> SampledType::Vec4where F: Float,

Fetch a single texel with a sampler set at compile time Sample the image at a coordinate by a lod

source

pub fn sample_by_gradient<F>( &self, sampler: Sampler, coordinate: impl ImageCoordinate<F, DIM, ARRAYED>, gradient_dx: impl ImageCoordinate<F, DIM, { _ }>, gradient_dy: impl ImageCoordinate<F, DIM, { _ }> ) -> SampledType::Vec4where F: Float,

Sample the image based on a gradient formed by (dx, dy). Specifically, ([du/dx, dv/dx], [du/dy, dv/dy])

source

pub fn sample_depth_reference<F>( &self, sampler: Sampler, coordinate: impl ImageCoordinate<F, DIM, ARRAYED>, depth_reference: f32 ) -> SampledTypewhere F: Float,

Sample the image’s depth reference

source

pub fn sample_depth_reference_by_lod<F>( &self, sampler: Sampler, coordinate: impl ImageCoordinate<F, DIM, ARRAYED>, depth_reference: f32, lod: f32 ) -> SampledTypewhere F: Float,

Sample the image’s depth reference based on an explicit lod

source

pub fn sample_depth_reference_by_gradient<F>( &self, sampler: Sampler, coordinate: impl ImageCoordinate<F, DIM, ARRAYED>, depth_reference: f32, gradient_dx: impl ImageCoordinate<F, DIM, { _ }>, gradient_dy: impl ImageCoordinate<F, DIM, { _ }> ) -> SampledTypewhere F: Float,

Sample the image’s depth reference based on a gradient formed by (dx, dy). Specifically, ([du/dx, dv/dx], [du/dy, dv/dy])

source§

impl<SampledType: SampleType<FORMAT>, const DIM: u32, const DEPTH: u32, const SAMPLED: u32, const FORMAT: u32> Image<SampledType, DIM, DEPTH, { _ }, { _ }, SAMPLED, FORMAT>

source

pub fn sample_with_project_coordinate<F>( &self, sampler: Sampler, project_coordinate: impl ImageCoordinate<F, DIM, { _ }> ) -> SampledType::Vec4where F: Float,

Sample the image with a project coordinate

source

pub fn sample_with_project_coordinate_by_lod<F>( &self, sampler: Sampler, project_coordinate: impl ImageCoordinate<F, DIM, { _ }>, lod: f32 ) -> SampledType::Vec4where F: Float,

Sample the image with a project coordinate by a lod

source

pub fn sample_with_project_coordinate_by_gradient<F>( &self, sampler: Sampler, project_coordinate: impl ImageCoordinate<F, DIM, { _ }>, gradient_dx: impl ImageCoordinate<F, DIM, { _ }>, gradient_dy: impl ImageCoordinate<F, DIM, { _ }> ) -> SampledType::Vec4where F: Float,

Sample the image with a project coordinate based on a gradient formed by (dx, dy). Specifically, ([du/dx, dv/dx], [du/dy, dv/dy])

source

pub fn sample_depth_reference_with_project_coordinate<F>( &self, sampler: Sampler, project_coordinate: impl ImageCoordinate<F, DIM, { _ }>, depth_reference: f32 ) -> SampledTypewhere F: Float,

Sample the image’s depth reference with the project coordinate

source

pub fn sample_depth_reference_with_project_coordinate_by_lod<F>( &self, sampler: Sampler, coordinate: impl ImageCoordinate<F, DIM, { _ }>, depth_reference: f32, lod: f32 ) -> SampledTypewhere F: Float,

Sample the image’s depth reference with the project coordinate based on an explicit lod

source

pub fn sample_depth_reference_with_project_coordinate_by_gradient<F>( &self, sampler: Sampler, coordinate: impl ImageCoordinate<F, DIM, { _ }>, depth_reference: f32, gradient_dx: impl ImageCoordinate<F, DIM, { _ }>, gradient_dy: impl ImageCoordinate<F, DIM, { _ }> ) -> SampledTypewhere F: Float,

Sample the image’s depth reference with the project coordinate based on a gradient formed by (dx, dy). Specifically, ([du/dx, dv/dx], [du/dy, dv/dy])

source§

impl<SampledType: SampleType<FORMAT>, const DIM: u32, const DEPTH: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const FORMAT: u32> Image<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, { _ }, FORMAT>

source

pub fn read<I>( &self, coordinate: impl ImageCoordinate<I, DIM, ARRAYED> ) -> SampledType::Vec4where I: Integer,

Read a texel from an image without a sampler.

source

pub unsafe fn write<I, const N: usize>( &self, coordinate: impl ImageCoordinate<I, DIM, ARRAYED>, texels: impl Vector<SampledType, N> )where I: Integer,

Write a texel to an image without a sampler.

source§

impl<SampledType: SampleType<FORMAT>, const DIM: u32, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const MULTISAMPLED: u32> Image<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, { _ }, FORMAT>

source

pub fn read<I>( &self, coordinate: impl ImageCoordinate<I, DIM, ARRAYED> ) -> SampledType::Vec4where I: Integer,

Read a texel from an image without a sampler.

source

pub unsafe fn write<I, const N: usize>( &self, coordinate: impl ImageCoordinate<I, DIM, ARRAYED>, texels: impl Vector<SampledType, N> )where I: Integer,

Write a texel to an image without a sampler.

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const FORMAT: u32> Image<SampledType, { _ }, DEPTH, ARRAYED, MULTISAMPLED, { _ }, FORMAT>

source

pub fn read_subpass<I>( &self, coordinate: impl ImageCoordinateSubpassData<I, ARRAYED> ) -> SampledType::Vec4where I: Integer,

Read a texel from subpass input attachment. Note: Vulkan only allows the read if the first two components of the coordinate are zero.

source§

impl<SampledType: SampleType<FORMAT>, const DIM: u32, const DEPTH: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32, const FORMAT: u32> Image<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>

source

pub fn query_levels(&self) -> u32where Self: HasQueryLevels,

Query the number of mipmap levels.

source

pub fn query_lod( &self, sampler: Sampler, coord: impl ImageCoordinate<f32, DIM, { _ }> ) -> SampledType::Vec2where Self: HasQueryLevels,

Query the mipmap level and the level of detail for a hypothetical sampling of Image at Coordinate using an implicit level of detail. The first component of the result contains the mipmap array layer. The second component of the result contains the implicit level of detail relative to the base level.

source

pub fn query_size<Size: ImageCoordinate<u32, DIM, ARRAYED> + Default>( &self ) -> Sizewhere Self: HasQuerySize,

Query the dimensions of Image, with no level of detail.

source§

impl<SampledType: SampleType<FORMAT>, const DIM: u32, const DEPTH: u32, const ARRAYED: u32, const SAMPLED: u32, const FORMAT: u32> Image<SampledType, DIM, DEPTH, ARRAYED, { _ }, SAMPLED, FORMAT>

source

pub fn query_size_lod<Size: ImageCoordinate<u32, DIM, ARRAYED> + Default>( &self, lod: u32 ) -> Sizewhere Self: HasQuerySizeLod,

Query the dimensions of Image, with no level of detail.

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const ARRAYED: u32, const SAMPLED: u32, const FORMAT: u32> Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, SAMPLED, FORMAT>

source

pub fn query_samples(&self) -> u32

Query the number of samples available per texel fetch in a multisample image.

Trait Implementations§

source§

impl<SampledType: Clone + SampleType<FORMAT>, const DIM: u32, const DEPTH: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32, const FORMAT: u32> Clone for Image<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>

source§

fn clone( &self ) -> Image<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>

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<SampledType: Copy + SampleType<FORMAT>, const DIM: u32, const DEPTH: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32, const FORMAT: u32> Copy for Image<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const SAMPLED: u32> HasGather for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const SAMPLED: u32> HasGather for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const SAMPLED: u32> HasGather for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32> HasQueryLevels for Image<SampledType, { _ }, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32> HasQueryLevels for Image<SampledType, { _ }, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32> HasQueryLevels for Image<SampledType, { _ }, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32> HasQueryLevels for Image<SampledType, { _ }, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32> HasQuerySize for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, { _ }, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32> HasQuerySize for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, { _ }, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32> HasQuerySize for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, { _ }, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32> HasQuerySize for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, { _ }, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32> HasQuerySize for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, { _ }, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32> HasQuerySize for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, { _ }, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32> HasQuerySize for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, { _ }, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32> HasQuerySize for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, { _ }, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const SAMPLED: u32> HasQuerySize for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const SAMPLED: u32> HasQuerySize for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const SAMPLED: u32> HasQuerySize for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const SAMPLED: u32> HasQuerySize for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32> HasQuerySize for Image<SampledType, { _ }, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32> HasQuerySize for Image<SampledType, { _ }, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const SAMPLED: u32> HasQuerySizeLod for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const SAMPLED: u32> HasQuerySizeLod for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const SAMPLED: u32> HasQuerySizeLod for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, SAMPLED, FORMAT>

source§

impl<SampledType: SampleType<FORMAT>, const DEPTH: u32, const FORMAT: u32, const ARRAYED: u32, const SAMPLED: u32> HasQuerySizeLod for Image<SampledType, { _ }, DEPTH, ARRAYED, { _ }, SAMPLED, FORMAT>

Auto Trait Implementations§

§

impl<SampledType, const DIM: u32, const DEPTH: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32, const FORMAT: u32> RefUnwindSafe for Image<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>where SampledType: RefUnwindSafe,

§

impl<SampledType, const DIM: u32, const DEPTH: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32, const FORMAT: u32> Send for Image<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>where SampledType: Send,

§

impl<SampledType, const DIM: u32, const DEPTH: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32, const FORMAT: u32> Sync for Image<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>where SampledType: Sync,

§

impl<SampledType, const DIM: u32, const DEPTH: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32, const FORMAT: u32> Unpin for Image<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>where SampledType: Unpin,

§

impl<SampledType, const DIM: u32, const DEPTH: u32, const ARRAYED: u32, const MULTISAMPLED: u32, const SAMPLED: u32, const FORMAT: u32> UnwindSafe for Image<SampledType, DIM, DEPTH, ARRAYED, MULTISAMPLED, SAMPLED, FORMAT>where SampledType: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.