Skip to main content

texture_row_layout

Function texture_row_layout 

Source
pub fn texture_row_layout(
    width: u32,
    height: u32,
    bytes_per_texel: u32,
) -> TextureRowLayout
Expand description

Compute the 256-aligned row pitch for a texture upload/readback.

WebGPU requires the bytes_per_row of a buffer↔texture copy to be a multiple of COPY_BYTES_PER_ROW_ALIGNMENT (256). Callers must allocate padded_bytes_per_row * height bytes of staging and copy each row into its padded slot.