pub fn readback_texture(
device: &Device,
queue: &Queue,
texture: &Texture,
) -> Vec<u8> ⓘExpand description
Copy texture back to the host as tight rows.
The texture’s own dimensions and format decide the copy, so the result is
its whole mip level 0 with no row padding: the buffer rows wgpu requires to
be aligned to [wgpu::COPY_BYTES_PER_ROW_ALIGNMENT] are stripped back off.
A row is the texture’s width rounded up to whole format blocks, so a
block-compressed texture reads back block-aligned exactly as wgpu lays it
out.
The bytes are in the texture’s format — an sRGB texture reads back sRGB
values, a Rgba8Unorm one linear ones — and the call blocks until the copy
has run.
§Panics
If the texture’s format has no block copy size (a depth-stencil format read without choosing an aspect, say), or if the copy cannot run.