Skip to main content

Module gpu

Module gpu 

Expand description

wgpu state, asked for in a size this machine can give.

This module exists for one line: RenderContext::new_device requests the device with wgpu::MemoryHints::Manual instead of the default.

vello::util::RenderContext defaults to MemoryHints::Performance — right for a game alone on a discrete card, wrong for a Tilo session where a dozen clients share one integrated GPU whose memory is the machine’s memory. Measured on an idle file manager: 488 MB across 459 buffers, of which 448 MB was three suballocator chunks (256 + 128 + 64 MB) and only 20 MB was actual content. Thirteen clients paying that is the whole 16 GB GTT window, and a GPU allocation that can neither be served nor fail takes the box with it — no OOM, no panic, just a freeze.

Not a patched vello: RenderSurface’s fields are public and Renderer::new takes a plain &Device, so only DeviceHandle needed reimplementing, for its private adapter field. vello stays unmodified, and this file stays close to vello::util’s own logic so the two can be compared when vello moves.

It also decides which backends the instance is made with (default_backends): without OpenGL whenever OpenGL could not be chosen anyway, because wgpu initialises every backend it is asked for.

Structs§

DeviceHandle
An adapter and the device opened on it.
DeviceLossMonitor
Shared, read-only observation of the context-owned device loss callback.
RenderContext
wgpu state for one process, with a memory hint that fits a shared GPU.

Enums§

CreateSurfaceError
Why a surface could not be made.

Constants§

ADAPTER_LINE_PREFIX
Prefix of every line a window prints about the adapter it renders on. The compositor reads app stderr for it; session checks grep for it.
SOFTWARE_FALLBACK_MESSAGE
What follows ADAPTER_LINE_PREFIX when a window presents through a CPU adapter on a machine that has a GPU.