1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 12:50:04 -04:00
Files
egui/crates/egui-wgpu
Lucas Meurer 32a8d1c378 egui-wgpu: let paint callbacks read the backdrop
Adds `CallbackTrait::needs_backdrop`, so an effect can transform what egui has
already drawn rather than draw over it. Background blur behind a window or a
panel is the motivating case.

Nothing can sample the texture it is currently drawing into, so this needs the
render pass interrupted and the half-drawn frame copied aside. The renderer
does not own its pass, so the integration has to drive that: `render_from`
draws until it reaches a callback that wants a backdrop and stops, and
`capture_backdrop` copies the frame and lets the callback run its own passes
over it. `render` still works as before for integrations that do not care;
callbacks that asked for a backdrop just get a plain `paint`.

The surface texture cannot be copied from on every platform, which is why
`CaptureState` exists for screenshots. `Painter` now renders into that texture
whenever a backdrop is needed too, and blits it onto the surface afterwards, so
`copy_textures` is split into `copy_to_buffer` and `blit_to_surface`.

`egui_kittest`'s wgpu renderer drives the same loop, so backdrop effects can be
snapshot-tested.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 21:58:31 +02:00
..

egui-wgpu

Latest version Documentation MIT Apache

This crates provides bindings between egui and wgpu.

This was originally hosted at https://github.com/hasenbanck/egui_wgpu_backend