Skip to content

Commit ecca997

Browse files
Minor API additions (#97)
1 parent be395b6 commit ecca997

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ impl<W> Encoder<W> {
288288
/// ## See also
289289
///
290290
/// - [`MipmapOptions::resize_filter`]
291-
#[derive(Debug, Clone, Copy, Default)]
291+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
292292
pub enum ResizeFilter {
293293
/// Nearest neighbor interpolation (=point filtering).
294294
Nearest,

src/layout.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,16 @@ impl DataLayout {
754754
DataLayout::TextureArray(texture_array) => texture_array.size(),
755755
}
756756
}
757+
/// The number of mipmaps each texture/volume in this layout has.
758+
///
759+
/// This is guaranteed to be at least 1.
760+
pub fn mipmaps(&self) -> u8 {
761+
match self {
762+
DataLayout::Texture(texture) => texture.mipmaps(),
763+
DataLayout::Volume(volume) => volume.mipmaps(),
764+
DataLayout::TextureArray(texture_array) => texture_array.mipmaps(),
765+
}
766+
}
757767

758768
/// If this layout is a [`DataLayout::Texture`], returns the texture.
759769
pub fn texture(&self) -> Option<Texture> {

0 commit comments

Comments
 (0)