Skip to main content

Module offscreen

Module offscreen 

Source
Expand description

One egui pass drawn into an offscreen texture: the captures of a pass nothing presents (the desktop loop’s, the browser pump’s). Render one egui pass into an offscreen texture and read it back.

An on-demand pass (on_demand: the desktop loop’s, the browser pump’s) never presents: a hidden Wayland surface gets no frame callbacks and presenting to it can block, and a hidden tab gets no animation frames. A capture asked for during such a pass is drawn here instead, with the window’s own egui_wgpu::RenderState: the same device, the same renderer (so its textures and the 3D viewport’s paint-callback resources are the ones the window draws with) and the same target format.

Structs§

Drawn
A pass drawn offscreen and copied into a read-back buffer, on its way to the CPU.

Functions§

apply_texture_frees
Free the textures the pass released, after anything that drew with them.
apply_texture_sets
Upload the pass’s new and changed textures to the shared renderer. The window’s next real frame never sees this pass’s texture delta, so the pass must apply it itself (a font atlas page added here is drawn there).
capture
Draw shapes at size_px (pixels_per_point) over clear and return the picture, waiting for the GPU. Its texture delta must already be applied (apply_texture_sets). Native only: the browser reads back with Drawn::on_ready.
draw
Draw shapes into an offscreen texture of size_px over clear, and copy it into a buffer the CPU can map: Drawn::wait (native) or Drawn::on_ready (any target) delivers the picture.