Struct vulkano::image::view::ImageViewCreateInfo
source · 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
impl ImageViewCreateInfo
sourcepub fn from_image(image: &Image) -> Self
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.