Struct nannou_wgpu::Extent3d[]

#[repr(C)]
pub struct Extent3d { pub width: u32, pub height: u32, pub depth_or_array_layers: u32, }
Expand description

Extent of a texture related operation.

Fields

width: u32
height: u32
depth_or_array_layers: u32

Implementations

Calculates the physical size is backing an texture of the given format and extent. This includes padding to the block width and height of the format.

This is the texture extent that you must upload at when uploading to mipmaps of compressed textures.

let format = wgpu::TextureFormat::Bc1RgbaUnormSrgb; // 4x4 blocks
assert_eq!(
    wgpu::Extent3d { width: 7, height: 7, depth_or_array_layers: 1 }.physical_size(format),
    wgpu::Extent3d { width: 8, height: 8, depth_or_array_layers: 1 }
);
// Doesn't change, already aligned
assert_eq!(
    wgpu::Extent3d { width: 8, height: 8, depth_or_array_layers: 1 }.physical_size(format),
    wgpu::Extent3d { width: 8, height: 8, depth_or_array_layers: 1 }
);
let format = wgpu::TextureFormat::Astc8x5RgbaUnorm; // 8x5 blocks
assert_eq!(
    wgpu::Extent3d { width: 7, height: 7, depth_or_array_layers: 1 }.physical_size(format),
    wgpu::Extent3d { width: 8, height: 10, depth_or_array_layers: 1 }
);

Calculates the maximum possible count of mipmaps.

Treats the depth as part of the mipmaps. If calculating for a 2DArray texture, which does not mipmap depth, set depth to 1.

assert_eq!(wgpu::Extent3d { width: 1, height: 1, depth_or_array_layers: 1 }.max_mips(), 1);
assert_eq!(wgpu::Extent3d { width: 60, height: 60, depth_or_array_layers: 1 }.max_mips(), 6);
assert_eq!(wgpu::Extent3d { width: 240, height: 1, depth_or_array_layers: 1 }.max_mips(), 8);

Calculates the extent at a given mip level.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

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

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.