pub struct ClearViews {
views: SmallVec<[Box<dyn DynTextureView>; 1]>,
mip_level_count: u32,
array_layer_count: u32,
aspects: &'static [TextureAspect],
}Expand description
Views for clearing a 2D texture with render passes. The contained views must be manually
destroyed by calling Self::destroy.
This helper encapsulates the indexing logic for clear views (in Self::views),
to reduce the chance of doing so incorrectly and failing to properly clear a texture.
Color and depth/stencil textures have a single clear view with wgt::TextureAspect::All.
This is true even for combined depth/stencil formats, which clear both aspects
simultaneously using a single view. The number of views is (mip level count) * (array
layer count).
Multi-planar textures have a clear view per plane. The number of views is (mip level count) * (array layer count) * (plane count).
Fields§
§views: SmallVec<[Box<dyn DynTextureView>; 1]>§mip_level_count: u32§array_layer_count: u32§aspects: &'static [TextureAspect]Implementations§
Source§impl ClearViews
impl ClearViews
Sourcepub(crate) fn new<E>(
label: Label<'_>,
usage: TextureUses,
format: TextureFormat,
mip_level_count: u32,
array_layer_count: u32,
create_view: impl FnMut(&TextureViewDescriptor<'_>) -> Result<Box<dyn DynTextureView>, E>,
) -> Result<Self, E>
pub(crate) fn new<E>( label: Label<'_>, usage: TextureUses, format: TextureFormat, mip_level_count: u32, array_layer_count: u32, create_view: impl FnMut(&TextureViewDescriptor<'_>) -> Result<Box<dyn DynTextureView>, E>, ) -> Result<Self, E>
Creates ClearViews by calling the provided create_view closure with (mip_level, array_layer, aspect) for each clear view of the texture.
Sourcefn views(
&self,
mip_level: u32,
array_layer: u32,
) -> impl Iterator<Item = (TextureAspect, &dyn DynTextureView)>
fn views( &self, mip_level: u32, array_layer: u32, ) -> impl Iterator<Item = (TextureAspect, &dyn DynTextureView)>
Returns an iterator over the clear view(s) for the given mip level and array layer.
The iterator yields tuples (wgt::TextureAspect, &dyn hal::DynTextureView) of
clear views and their associated wgt::TextureAspects.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClearViews
impl !RefUnwindSafe for ClearViews
impl Send for ClearViews
impl Sync for ClearViews
impl Unpin for ClearViews
impl UnsafeUnpin for ClearViews
impl !UnwindSafe for ClearViews
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more