You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
anyrender_vello: each window creates its own wgpu device and Vello renderer (~180 MB per window) #121
Every VelloWindowRenderer owns its own WGPUContext (wgpu instance + device pool) and its own vello::Renderer, so an app with several windows pays the whole GPU setup once per window. VelloWindowRenderer has no way to share them: no constructor or option takes an existing context
or device.
Measurements
macOS (Apple M2 Max), Retina windows, a simple page with some text and a button, rendered with Blitz
(blitz-shell with several Views). macOS "physical footprint", ~6 s after launch:
Windows
Stock VelloWindowRenderer
Shared device + renderer (patch below)
1
223 MB
223 MB
2
424 MB
240 MB
4
802 MB
273 MB
Almost all of it is the "graphics" category (178 MB for one window, 714 MB for four). With the device
and the Vello renderer shared, an extra window costs ~16 MB (its surface and intermediate texture).
A gotcha even if contexts were shared
The new device is only added to device_pool in complete_resume, which runs later (when the
embedder handles the "ready" callback). Windows created at startup all call resume before any of
them completes, so none of them finds a device to reuse, even with a shared WGPUContext.
Proposal
An opt-in shared context, without changing the existing API:
SharedVelloContext holds the WGPUContext and one vello::Renderer per device (Rc<RefCell<…>>,
since windows live on the event-loop thread). new() / with_options() keep working as today with a
private context. The device is registered as soon as it is created, so startup windows reuse it.
anyrender_vello_hybrid seems to have the same one-device-per-window structure; happy to look at it
in a follow-up if this approach is OK. Related: #12 (memory usage of backends).
Activity