Function validate_linear_texture_data

Source
pub(crate) fn validate_linear_texture_data(
    layout: &TexelCopyBufferLayout,
    format: TextureFormat,
    aspect: TextureAspect,
    buffer_size: BufferAddress,
    buffer_side: CopySide,
    copy_size: &Extent3d,
) -> Result<(BufferAddress, BufferAddress, bool), TransferError>
Expand description

WebGPU’s validating linear texture data algorithm.

Copied with some modifications from WebGPU standard.

If successful, returns a tuple (bytes, stride, is_contiguous), where:

  • bytes is the number of buffer bytes required for this copy, and
  • stride number of bytes between array layers.
  • is_contiguous is true if the linear texture data does not have padding between rows or between images.