[][src]Enum vulkano::image::ImageDimensions

pub enum ImageDimensions {
    Dim1d {
        width: u32,
        array_layers: u32,
    },
    Dim2d {
        width: u32,
        height: u32,
        array_layers: u32,
        cubemap_compatible: bool,
    },
    Dim3d {
        width: u32,
        height: u32,
        depth: u32,
    },
}

Variants

Dim1d

Fields of Dim1d

width: u32array_layers: u32
Dim2d

Fields of Dim2d

width: u32height: u32array_layers: u32cubemap_compatible: bool
Dim3d

Fields of Dim3d

width: u32height: u32depth: u32

Implementations

impl ImageDimensions[src]

pub fn width(&self) -> u32[src]

pub fn height(&self) -> u32[src]

pub fn width_height(&self) -> [u32; 2][src]

pub fn depth(&self) -> u32[src]

pub fn width_height_depth(&self) -> [u32; 3][src]

pub fn array_layers(&self) -> u32[src]

pub fn num_texels(&self) -> u32[src]

Returns the total number of texels for an image of these dimensions.

pub fn max_mipmaps(&self) -> u32[src]

Returns the maximum number of mipmaps for these image dimensions.

The returned value is always at least superior or equal to 1.

Example

use vulkano::image::ImageDimensions;

let dims = ImageDimensions::Dim2d {
    width: 32,
    height: 50,
    cubemap_compatible: false,
    array_layers: 1,
};

assert_eq!(dims.max_mipmaps(), 6);

pub fn mipmap_dimensions(&self, level: u32) -> Option<ImageDimensions>[src]

Returns the dimensions of the levelth mipmap level. If level is 0, then the dimensions are left unchanged.

Returns None if level is superior or equal to max_mipmaps().

Example

use vulkano::image::ImageDimensions;

let dims = ImageDimensions::Dim2d {
    width: 963,
    height: 256,
    cubemap_compatible: false,
    array_layers: 1,
};

assert_eq!(dims.mipmap_dimensions(0), Some(dims));
assert_eq!(dims.mipmap_dimensions(1), Some(ImageDimensions::Dim2d {
    width: 481,
    height: 128,
    cubemap_compatible: false,
    array_layers: 1,
}));
assert_eq!(dims.mipmap_dimensions(6), Some(ImageDimensions::Dim2d {
    width: 15,
    height: 4,
    cubemap_compatible: false,
    array_layers: 1,
}));
assert_eq!(dims.mipmap_dimensions(9), Some(ImageDimensions::Dim2d {
    width: 1,
    height: 1,
    cubemap_compatible: false,
    array_layers: 1,
}));
assert_eq!(dims.mipmap_dimensions(11), None);

Panic

In debug mode, Panics if width, height or depth is equal to 0. In release, returns an unspecified value.

Trait Implementations

impl Clone for ImageDimensions[src]

impl Copy for ImageDimensions[src]

impl Debug for ImageDimensions[src]

impl Eq for ImageDimensions[src]

impl PartialEq<ImageDimensions> for ImageDimensions[src]

impl StructuralEq for ImageDimensions[src]

impl StructuralPartialEq for ImageDimensions[src]

Auto Trait Implementations

impl RefUnwindSafe for ImageDimensions

impl Send for ImageDimensions

impl Sync for ImageDimensions

impl Unpin for ImageDimensions

impl UnwindSafe for ImageDimensions

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Content for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.