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
Windows: Surface::configure panics when a resize reports a wrapped negative height #306
Rune rev:4ca6835 · Platform: Windows 11, DX12 (seen under WARP, likely any adapter)
What happens
If the window is resized right after it appears (for example by SetWindowPos to 1172x777), the main thread sometimes panics:
wgpu error: Validation Error
In Surface::configure
Requested was (1156, 65527)
The height 65527 is a negative client height wrapped to u16. It reproduced in 3 of about 8 attempts, at 829x550 just after launch and when shrinking 1658x1099 to 1172x777.
Expected
A bogus size from the platform should never take the app down.
Possible solution
In the drawable-size calculation (window.rsdrawable_size) and the Windows resize path, ignore any size whose edge exceeds device.limits().max_texture_dimension_2d (or is 0). Keep the previous drawable until a sane size arrives, and clamp a window created at such a size to the largest the device takes.
After this change, 8 of 8 attempts survived. Reference commit: df25377 on the fork (see a_drawable_never_takes_a_size_that_wrapped_below_zero in window/tests.rs).
Windows resize events and client-size queries can transiently wrap a negative client height to u16 (like 65527) or u32, which bypassed texture-limit checks, invalidated the surface, stretched the viewport, and oversized the CPU boot buffer. Fixed on dev in #1449 (ee4e99b7): resizes outside 1..=max_texture_dimension_2d now keep the previous drawable and viewport, and initial surface creation and reattach clamp to the limit.
Activity
Hona commentedon Nov 23, 2026
Windows resize events and client-size queries can transiently wrap a negative client height to
u16(like65527) oru32, which bypassed texture-limit checks, invalidated the surface, stretched the viewport, and oversized the CPU boot buffer. Fixed ondevin #1449 (ee4e99b7): resizes outside1..=max_texture_dimension_2dnow keep the previous drawable and viewport, and initial surface creation and reattach clamp to the limit.