Skip to main content

build_texture_array

Function build_texture_array 

Source
pub fn build_texture_array(images: &[Image]) -> Image
Expand description

Assembles N identically-sized Images into a single GPU texture_2d_array.

Each input image is expected to be the same pixel dimensions and format. The images are stacked in the order provided: layer 0 = images[0], layer 1 = images[1], etc.

Returns an Image whose texture_descriptor is configured as a D2 texture with depth_or_array_layers = N, suitable for binding as a texture_2d_array in a WGSL shader.

ยงPanics

Panics if images is empty or if images have different sizes / formats.