Clamp the window surface to the device's largest texture (#869) (#905)

Moving a window between monitors of different scale can briefly ask for a
surface larger than the device's largest texture (11512 x 6808 against 8192 in
the report), and Surface::configure failed validation, which wgpu turns into a
panic. The surface is now clamped to the device limit with its aspect ratio
kept, and egui draws the whole window at the matching smaller scale, so the
frame is only softer until the size settles. The device also asks for the
adapter's own texture limit (16384 on most desktop GPUs) instead of 8192, and
the resize path and an unsupported surface log instead of unwrapping.

Fixes #869

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bherbruckandClaude Opus 5.5 authored and GitHub committed 2026-10-13 21:19:40 -04:00
1 parent 897b7d93b5
commit d23593d3eb
6 files changed
+115 -12

No files matched your search

+3 -1
View File
@@ -269,7 +269,9 @@ impl WgpuSetupCreateNew {
required_limits: wgpu::Limits {
// When using a depth buffer, we have to be able to create a texture
// large enough for the entire surface, and we want to support 4k+ displays.
max_texture_dimension_2d: 8192,
// SolidCraft: ask for all the adapter offers (16384 on most desktop GPUs),
// never less than 8192, so a window spanning large monitors still fits.
max_texture_dimension_2d: adapter.limits().max_texture_dimension_2d.max(8192),
..base_limits
},
// SolidCraft: without it only the sample counts WebGPU guarantees (1x, 4x)