pub struct ImageViewCreateInfo {
    pub view_type: ImageViewType,
    pub format: Format,
    pub component_mapping: ComponentMapping,
    pub subresource_range: ImageSubresourceRange,
    pub usage: ImageUsage,
    pub sampler_ycbcr_conversion: Option<Arc<SamplerYcbcrConversion>>,
    pub _ne: NonExhaustive,
}
Expand description

Parameters to create a new ImageView.

Fields§

§view_type: ImageViewType

The image view type.

The view type must be compatible with the dimensions of the image and the selected array layers.

The default value is ImageViewType::Dim2d.

§format: Format

The format of the image view.

If this is set to a format that is different from the image, the image must be created with the mutable_format flag.

On portability subset devices, if format does not have the same number of components and bits per component as the parent image’s format, the image_view_format_reinterpretation feature must be enabled on the device.

The default value is Format::UNDEFINED.

§component_mapping: ComponentMapping

How to map components of each pixel.

On portability subset devices, if component_mapping is not the identity mapping, the image_view_format_swizzle feature must be enabled on the device.

The default value is ComponentMapping::identity().

§subresource_range: ImageSubresourceRange

The subresource range of the image that the view should cover.

The default value is empty, which must be overridden.

§usage: ImageUsage

How the image view is going to be used.

If usage is empty, then an implicit default value is used based on the parent image’s usages. Depending on the image aspects selected in subresource_range, the implicit usage will be equal to the parent image’s usage, its stencil_usage, or the intersection of the two.

If you set usage to a different value from the implicit default, then the device API version must be at least 1.1, or the khr_maintenance2 extension must be enabled on the device. The specified usage must be a subset of the implicit default value; usages that are not set for the parent image are not allowed.

The default value is ImageUsage::empty().

§sampler_ycbcr_conversion: Option<Arc<SamplerYcbcrConversion>>

The sampler YCbCr conversion to be used with the image view.

If set to Some, several restrictions apply:

  • The component_mapping must be the identity swizzle for all components.
  • If the image view is to be used in a shader, it must be in a combined image sampler descriptor, a separate sampled image descriptor is not allowed.
  • The corresponding sampler must have the same sampler YCbCr object or an identically created one, and must be used as an immutable sampler within a descriptor set layout.

The default value is None.

§_ne: NonExhaustive

Implementations§

source§

impl ImageViewCreateInfo

source

pub fn from_image(image: &Image) -> Self

Returns an ImageViewCreateInfo with the view_type determined from the image type and array layers, and subresource_range determined from the image format and covering the whole image.

Trait Implementations§

source§

impl Debug for ImageViewCreateInfo

source§

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

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

impl Default for ImageViewCreateInfo

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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