Performance: Low-Latency Drawing preference presents without vsync, capped at 240 fps

Preferences › Performance › Low-Latency Drawing (lowLatencyDrawing, off by
default) is read when the app starts and asks for wgpu's AutoNoVsync. The
present mode comes from --present-mode, then VECTORCRAFT_PRESENT_MODE, then
the preference, then the default; with the preference off and no override
the window surface is unchanged. The startup log names "(preference)" or
"(override)" after the mode.

Whenever the window presents without vsync, from the preference or an
override, main-window frames start at most 240 times a second (about
4.17 ms apart). The wait comes before egui reads the frame's input, and
the frame's time moves on by it. With vsync the display paces the frames
and no cap applies.

The checkbox shows on the desktop with the note that it applies the next
time VectorCraft starts. A value that is not a boolean is an error.

Fixes #6013
This commit is contained in:
dotCooCoo
2026-11-16 00:35:22 -08:00
parent ed6f22a84c
commit 3edb844683
38 changed files with 276 additions and 18 deletions
+1
View File
@@ -84,6 +84,7 @@ The canvas is rasterized on the CPU (`vectorcraft-render`, vello_cpu); the GPU (
- On Linux with Mesa, `MESA_VK_DEVICE_SELECT=10de:2f04!` (vendor:device as `vulkaninfo --summary` or `lspci -nn` show it) leaves only that GPU to Vulkan, and `DRI_PRIME=1` picks the other GPU.
- Help › About and the control channel's `ui.inspect` (`graphicsAdapter`) show the adapter in use, and the app logs it at startup.
- **How frames reach the display.** By default the window presents with `autovsync` and lets the display queue one frame. With `autovsync`, wgpu uses relaxed vsync (FifoRelaxed, which tears a frame that arrives late) where the driver offers it, else vsync (Fifo). For a launch, `--present-mode` (or `VECTORCRAFT_PRESENT_MODE`) sets the present mode to `fifo` (vsync), `autovsync` or `novsync` (wgpu uses Immediate, else Mailbox, else Fifo, whichever the driver offers), and `--frame-latency` (or `VECTORCRAFT_FRAME_LATENCY`) sets the frames the display may queue, `1` to `3`. A flag overrides its variable, and a value that is not one of these stops the app with a message. On Windows and Linux, a launch with either one set opens its files in a new window, as with `--new-instance`, instead of handing them to a running VectorCraft. At startup the log records what the app asks the window surface for, for example `requested window surface: autovsync, frame latency 2 (override)`. The driver chooses the mode that `autovsync` and `novsync` resolve to and may clamp the latency, and on macOS egui uses at least 2 frames while the window is being resized. The code is `apps/vectorcraft/src/presentation.rs`.
- **Preferences › Performance › Low-Latency Drawing** (`lowLatencyDrawing`, off by default) presents with `novsync` and is read when the app starts, so a change applies after a restart. The present mode comes from `--present-mode` first, then `VECTORCRAFT_PRESENT_MODE`, then this preference, then the default (`autovsync`); `--frame-latency` and `VECTORCRAFT_FRAME_LATENCY` still set the latency with it on. The log names where the mode came from: `requested window surface: novsync (preference), frame latency 1`. Whenever the window presents without vsync (`novsync`, from the preference or an override), frames start at most 240 times a second (about 4.17 ms apart); with vsync the display paces them and no cap applies.
## Logs
+5
View File
@@ -6845,6 +6845,11 @@ is converted on its own.
osManaged}`, where `source` is `profile`, `srgbProfile` (a profile that shows sRGB unchanged), `system`, `none`,
`pending` or `unsupported`, `applied` says whether the canvas is converted, and `reason` says why not.
`lowLatencyDrawing` (Preferences › Performance › Low-Latency Drawing, off by default; desktop app) is read when the app
starts. On, the window presents without vsync (wgpu's `AutoNoVsync`) and frames start at most 240 times a second.
`--present-mode` and `VECTORCRAFT_PRESENT_MODE` take precedence over it (see `docs/development.md` › Desktop graphics
processor). A value that is not a boolean is an error.
`ctrlWheelScrollsSideways` (on by default): on, Cmd/Ctrl with a mouse wheel's whole notches scrolls the canvas sideways
instead of zooming while `zoomWithMouseWheel` is off; off, Cmd/Ctrl-wheel zooms about the pointer. Alt + Cmd/Ctrl-wheel
and a pinch on a Mac trackpad, on a touch screen or in the web build still zoom about the pointer. Under either