Compare commits

...
Author SHA1 Message Date
FredApps e7e37f4f10 Prepare Windows graphics diagnostic 2026-12-04 19:01:58 +01:00
FredApps a4431ca5c4 Merge remote-tracking branch 'origin/main' into review/grid-761-windows 2026-12-04 19:01:44 +01:00
FredApps bf52922988 Merge main and keep the adapter texture limit fix 2026-12-04 08:27:14 +01:00
msaulcandClaude Opus 5.5 768a8a79f3 Windows and monitors wider than 8192 pixels keep their surface instead of crashing
eframe's device descriptor asks for exactly 8192 pixels of texture side, whatever the GPU offers,
and the window's surface is a texture. A window stretched across monitors that add up to more
(1080 + 3440 + 3840 = 8360 pixels at 100 %) failed Surface::configure ("Requested was (8344,
1261), maximum extent for either dimension is 8192"), which wgpu treats as fatal, so GridCraft
closed. The mixed-DPI drag fixed in the previous commit hit the same limit.

Ask for the adapter's own largest texture side (16384 on DirectX 12 and Metal hardware), keeping
eframe's other requirements, on every native platform and before the DirectX 12 probe that checks
adapters against these limits. A smaller adapter is never asked for more than it has. Verified on
Windows 11 24H2: the 8360-pixel window crashed before and stays up now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 11:10:11 -06:00
msaulcandClaude Opus 5.5 7d13161b03 Windows: dragging across monitors with different scales no longer grows the window and crashes
On Windows 11, dragging the window across the boundary between monitors with different display
scales (100 % and 250 % here) made it flip between the two scales and grow by their ratio, from
3600x2250 to 9048x5757. The surface then outgrew the 8192-pixel texture limit and wgpu's
validation error closed the app (Surface::configure, "Requested was (9048, 5757)").

The cause is winit 0.30.13's WM_DPICHANGED handling during a live drag (rust-windowing/winit#4041,
#4600): it replaces the rect Windows suggests with its own and nudges it back onto the monitor
being left, which triggers another DPI change. winit master fixed it in 488c036a (#4341), but
eframe 0.36 needs winit 0.30 and the fix isn't in a 0.30 release.

Patch winit to the single commit of rust-windowing/winit#4694, the 0.30.x backport (+21/-34 lines
in src/platform_impl/windows/event_loop.rs on top of v0.30.13), pinned by SHA as #389's review
asked for instead of a vendored copy. Verified on Windows 11 24H2 with a scripted mouse drag that
crashed every time before: the window now changes scale once and snaps to the target monitor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-12 10:59:34 -06:00
4 changed files with 70 additions and 4 deletions
@@ -0,0 +1,15 @@
name: Windows graphics diagnostic
on:
push:
branches: [diagnostic/grid-761-windows]
permissions:
contents: read
jobs:
windows-graphics:
uses: storytold/craft-common-actions/.github/workflows/gate.yml@main
with:
os: '["windows-latest"]'
craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83
targets: ""
timeout-minutes: 100
windows-command: cargo test --locked -p gridcraft --bin gridcraft
+50
View File
@@ -0,0 +1,50 @@
//! Preserve full-resolution surfaces on adapters that support textures larger than eframe's default.
use std::sync::Arc;
use eframe::{NativeOptions, egui_wgpu::WgpuSetup, wgpu::Limits};
/// Request the adapter's own texture-side limit, keeping every other requirement unchanged.
/// This also allows an otherwise suitable downlevel adapter to meet the descriptor.
fn surface_texture_limits(mut required: Limits, supported: &Limits) -> Limits {
required.max_texture_dimension_2d = supported.max_texture_dimension_2d;
required
}
/// Keep eframe's descriptor and request a larger surface where the selected adapter supports it.
pub fn request_adapter_texture_size(options: &mut NativeOptions) {
if let WgpuSetup::CreateNew(create) = &mut options.wgpu_options.wgpu_setup {
let device_descriptor = Arc::clone(&create.device_descriptor);
create.device_descriptor = Arc::new(move |adapter| {
let mut descriptor = device_descriptor(adapter);
descriptor.required_limits = surface_texture_limits(descriptor.required_limits, &adapter.limits());
descriptor
});
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn surface_texture_size_is_the_adapters_own() {
for base in [Limits::default(), Limits::downlevel_webgl2_defaults()] {
let required = Limits { max_texture_dimension_2d: 8192, ..base.clone() };
for side in [4096, 8192, 16384, 32768] {
let supported = Limits { max_texture_dimension_2d: side, ..base.clone() };
let actual = surface_texture_limits(required.clone(), &supported);
let expected = Limits { max_texture_dimension_2d: side, ..required.clone() };
assert_eq!(actual, expected);
assert!(actual.check_limits(&supported));
}
}
}
#[test]
fn native_options_keep_creating_their_own_device() {
let mut options = NativeOptions::default();
request_adapter_texture_size(&mut options);
assert!(matches!(options.wgpu_options.wgpu_setup, WgpuSetup::CreateNew(_)));
}
}
+4 -3
View File
@@ -17,6 +17,7 @@ mod apple_events;
mod build_channel;
mod build_flavor;
mod control_server;
mod gpu_limits;
#[cfg(any(target_os = "windows", target_os = "macos", test))]
mod graphics;
mod launch_profile;
@@ -551,9 +552,9 @@ fn main() -> eframe::Result<()> {
viewport = viewport.with_icon(i);
}
let window_builder = viewport.clone();
let options = eframe::NativeOptions { viewport, ..Default::default() };
#[cfg(target_os = "macos")]
let mut options = options;
let mut options = eframe::NativeOptions { viewport, ..Default::default() };
// Apply before the Windows adapter probe, which checks this same descriptor.
gpu_limits::request_adapter_texture_size(&mut options);
// Intel Macs: Metal's compiler aborts on wgpu's indirect-validation shaders (see graphics.rs).
#[cfg(target_os = "macos")]
graphics::configure_indirect_validation(&mut options, graphics::skips_indirect_validation(true, cfg!(target_arch = "x86_64")));
+1 -1
View File
@@ -12,7 +12,7 @@ The hardware Excel uses, per platform, against GridCraft. Part of
| Pen and touch (Draw tab) | Pen pressure and tilt, eraser end, touch mode, Ink to Shape, ink replay | Pen, highlighter, eraser, Ink to Shape with mouse/pen input; **no pressure or tilt**, no touch mode | Pressure-sensitive strokes where winit reports force; touch-friendly ribbon spacing: 4–6 h |
| Trackpad and mouse | Smooth scrolling, pinch zoom, horizontal scroll, Magic Mouse | Smooth scrolling and zoom via egui | Verify pinch zoom on each platform: 1–2 h |
| Multiple windows and monitors | One window per workbook, New Window for the same workbook, per-monitor DPI | A native window per workbook window on the desktop, New Window for the same workbook; new windows cascade from the last one on its monitor; View › Arrange All tiles, stacks or cascades them over the main window's monitor (web: one window) | Arrange All across monitors; verify per-monitor DPI with windows on two monitors: 2–3 h |
| High-DPI and display scaling | yes | yes (display scale matched to desktop density; View › Interface size 75–200 % on top, #230) | — |
| High-DPI and display scaling | yes | yes (display scale matched to desktop density; View › Interface size 75–200 % on top, #230; Windows 11 uses the suggested rectangle on DPI changes; native surfaces can use the adapter's texture-side limit) | Verify mixed-DPI drags and large surfaces on current hardware |
| Accessibility hardware (screen readers, braille displays, switch control) | Narrator, JAWS, NVDA, VoiceOver | AccessKit enabled in eframe; grid cells and ribbon not yet exposed as an accessible tree | Counted under UI ([ui-parity.md](ui-parity.md)) |
| Printers | System print with driver options | Desktop submits through craft-print with printer choice, copies, duplex and grayscale; web browser printing | Counted under print |