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

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

Fields of Dim1d

Fields of Dim2d

Fields of Dim3d

Methods

impl ImageDimensions
[src]

[src]

[src]

[src]

[src]

[src]

[src]

[src]

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

[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(), 7);

Panic

May panic if the dimensions are 0.

[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: 512,
    height: 128,
    cubemap_compatible: false,
    array_layers: 1,
}));
assert_eq!(dims.mipmap_dimensions(6), Some(ImageDimensions::Dim2d {
    width: 16,
    height: 4,
    cubemap_compatible: false,
    array_layers: 1,
}));
assert_eq!(dims.mipmap_dimensions(9), Some(ImageDimensions::Dim2d {
    width: 2,
    height: 1,
    cubemap_compatible: false,
    array_layers: 1,
}));
assert_eq!(dims.mipmap_dimensions(11), None);

Panic

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

Trait Implementations

impl Copy for ImageDimensions
[src]

impl Clone for ImageDimensions
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for ImageDimensions
[src]

[src]

Formats the value using the given formatter.

impl PartialEq for ImageDimensions
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Eq for ImageDimensions
[src]