Repository navigation
Closed
Description
Rune rev: 3ff3cc6 (same code at 5d421fd) · Platform: Linux (Fedora 44, niri), Vulkan on Intel Iris Xe and NVIDIA RTX 3050, wgpu 30.0.1
What happens
When a window showing a playing NativeSurface is resized (here by tx.toggle_full_screen()), the main thread sometimes panics:
wgpu error: Validation Error
In Surface::configure
Failed to wait for GPU to come idle before reconfiguring the Surface
from Win::resize_surface (window/win.rs) ← WindowEvent::Resized (window/events.rs).
The panic site is the same as #306, but the cause is different: here the size is fine, and the GPU queue isn't empty.
Why
- The check: wgpu-core's configure waits for the last submission and then requires an empty queue. If the queue isn't empty, it returns
GpuWaitTimeoutbefore it touches the surface. wgpu's own comment: "It can only be non-empty if another thread is submitting at the same time." - The other thread: when the device has
TIMESTAMP_QUERY(requested whenever the adapter has it),SurfaceRenderer::submit(native_surface/pipeline.rs) installs anon_submitted_work_donecallback that callsqueue.submit([timestamps.finish()]). That callback runs on therune-video-completionthread during itsdevice.poll, so it can land between configure's wait and its check.
Repro
Push frames to a NativeSurface at about 30 fps and toggle full screen every 0.75 s for 20 s:
| Setup | Panicked |
|---|---|
| Intel, X11 (XWayland) | 3/3 runs, after 2–13 toggles |
| NVIDIA, X11 (XWayland) | 2/3 |
| Intel, native Wayland | 1/3 |
| NVIDIA, native Wayland | 0/2 |
| Intel, X11, no video frames (control) | 0/4, about 24 toggles each |
In the app, a single full-screen toggle during playback sometimes crashes it.
Expected
A resize during playback never takes the app down.
Possible solution
- Remove the cause: don't submit from the completion thread. The callback could queue the slot to resolve, and the next
SurfaceRenderer::submiton the render thread could encode and submit the resolve. That still runs after the completion fence the Metal comment asks for, but the last frame's timing is reported only when another frame is submitted. - Make configure robust: in
Win::resize_surface, push anErrorFilter::Validationscope aroundsurface.configureand retry a few times while it reports an error.GpuWaitTimeoutfails before the surface changes, so a retry is safe. This also covers apps that submit from their own threads.
Metadata
Metadata
Assignees
Labels
No labels
Activity
Hona commentedon Nov 23, 2026
The cause from the report is gone: a frame's timestamp resolve was submitted from the
rune-video-completionthread and could land insideSurface::configure's wait. Surface configures and that submission now go through one gate, and a resolve that comes up during a configure is parked and submitted after it. (The panic itself had already become a failed configure and a replaced surface in #492.) Fixed ondevin #1589 (6e03e22). It was tested on D3D12 and Metal with a real device but no window, and compiled for Linux; the full-screen toggle on Vulkan was not repeated.edwrdc commentedon Nov 23, 2026
Thanks for your hard work!!