pub struct Image { /* private fields */ }
Expand description
A multi-dimensioned storage for texel data.
Unlike RawImage
, an Image
has memory backing it, and can be used normally.
Implementations§
source§impl Image
impl Image
sourcepub fn memory(&self) -> &ImageMemory
pub fn memory(&self) -> &ImageMemory
Returns the type of memory that is backing this image.
sourcepub fn memory_requirements(&self) -> &[MemoryRequirements]
pub fn memory_requirements(&self) -> &[MemoryRequirements]
Returns the memory requirements for this image.
- If
self.flags().disjoint
is not set, this returns a slice with a length of 1. - If
self.flags().disjoint
is set, this returns a slice with a length equal toself.format().unwrap().planes().len()
.
sourcepub fn flags(&self) -> ImageCreateFlags
pub fn flags(&self) -> ImageCreateFlags
Returns the flags the image was created with.
sourcepub fn dimensions(&self) -> ImageDimensions
pub fn dimensions(&self) -> ImageDimensions
Returns the dimensions of the image.
sourcepub fn format_features(&self) -> &FormatFeatures
pub fn format_features(&self) -> &FormatFeatures
Returns the features supported by the image’s format.
sourcepub fn mip_levels(&self) -> u32
pub fn mip_levels(&self) -> u32
Returns the number of mipmap levels in the image.
sourcepub fn initial_layout(&self) -> ImageLayout
pub fn initial_layout(&self) -> ImageLayout
Returns the initial layout of the image.
sourcepub fn samples(&self) -> SampleCount
pub fn samples(&self) -> SampleCount
Returns the number of samples for the image.
sourcepub fn tiling(&self) -> ImageTiling
pub fn tiling(&self) -> ImageTiling
Returns the tiling of the image.
sourcepub fn usage(&self) -> &ImageUsage
pub fn usage(&self) -> &ImageUsage
Returns the usage the image was created with.
sourcepub fn stencil_usage(&self) -> &ImageUsage
pub fn stencil_usage(&self) -> &ImageUsage
Returns the stencil usage the image was created with.
sourcepub fn sharing(&self) -> &Sharing<SmallVec<[u32; 4]>>
pub fn sharing(&self) -> &Sharing<SmallVec<[u32; 4]>>
Returns the sharing the image was created with.
sourcepub fn external_memory_handle_types(&self) -> ExternalMemoryHandleTypes
pub fn external_memory_handle_types(&self) -> ExternalMemoryHandleTypes
Returns the external memory handle types that are supported with this image.
sourcepub fn subresource_layers(&self) -> ImageSubresourceLayers
pub fn subresource_layers(&self) -> ImageSubresourceLayers
Returns an ImageSubresourceLayers
covering the first mip level of the image. All aspects
of the image are selected, or plane0
if the image is multi-planar.
sourcepub fn subresource_range(&self) -> ImageSubresourceRange
pub fn subresource_range(&self) -> ImageSubresourceRange
Returns an ImageSubresourceRange
covering the whole image. If the image is multi-planar,
only the color
aspect is selected.
sourcepub fn subresource_layout(
&self,
aspect: ImageAspect,
mip_level: u32,
array_layer: u32
) -> Result<SubresourceLayout, ImageError>
pub fn subresource_layout(
&self,
aspect: ImageAspect,
mip_level: u32,
array_layer: u32
) -> Result<SubresourceLayout, ImageError>
Queries the memory layout of a single subresource of the image.
Only images with linear tiling are supported, if they do not have a format with both a
depth and a stencil format. Images with optimal tiling have an opaque image layout that is
not suitable for direct memory accesses, and likewise for combined depth/stencil formats.
Multi-planar formats are supported, but you must specify one of the planes as the aspect
,
not ImageAspect::Color
.
The layout is invariant for each image. However it is not cached, as this would waste memory in the case of non-linear-tiling images. You are encouraged to store the layout somewhere in order to avoid calling this semi-expensive function at every single memory access.