Skip to main content

Module readback

Module readback 

Source
Expand description

RGBA8 read-back of rendered frames without stalling on the GPU.

A FrameReader owns a small ring of staging buffers. Each frame records a copy of the target into a free buffer (FrameReader::copy); after the submit, FrameReader::submitted asks for the buffer to be mapped, and FrameReader::read_latest later hands out the newest frame the GPU has finished, without waiting. That costs one or two frames of latency instead of a full GPU round trip per frame, and works in the browser too (wgpu maps buffers from the event loop there). FrameReader::read_blocking waits instead, for hosts that want the frame they just rendered.

Structs§

FrameReader
Ring of staging buffers reading back a width x height target with 4 bytes per texel (Rgba8Unorm, Bgra8Unorm, …). Make a new one when the size changes.