Use adapter texture limit for probed window device (#3853)

* Use adapter texture limit for probed window device

Mixed-DPI dragging can grow the window past 8192 px; the probed device should allow the adapter's full texture size so the window keeps rendering.

Change probe to request the adapter's max_texture_dimension_2d and add a GPU test asserting the probed device matches the adapter limit.

Test: probed_device_uses_adapter_max_texture_size failed before the change and passes after.

* Window device: the adapter's texture limit on GL too, which the conservative defaults would cap at 2048

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: eliets2 <287273517+eliets2@users.noreply.github.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
eliets2
2026-11-06 15:15:23 +01:00
committed by GitHub
co-authored by Claude Opus 5.5 eliets2 FredApps
parent 45ba859f88
commit e354de502b
+18 -1
View File
@@ -219,7 +219,8 @@ fn probe(backends: Backends, compose_window: bool) -> Result<WgpuSetupExisting,
let base = if adapter.get_info().backend == wgpu::Backend::Gl { wgpu::Limits::downlevel_webgl2_defaults() } else { adapter.limits() };
let (device, queue) = pollster::block_on(adapter.request_device(&wgpu::DeviceDescriptor {
label: Some("egui wgpu device"),
required_limits: wgpu::Limits { max_texture_dimension_2d: 8192, ..base },
// (GL takes the conservative defaults for everything else, whose 2048 is too small for a window)
required_limits: wgpu::Limits { max_texture_dimension_2d: adapter.limits().max_texture_dimension_2d, ..base },
..Default::default()
}))
.map_err(|e| format!("{}: no device: {e}", adapter.get_info().name))?;
@@ -397,6 +398,22 @@ mod tests {
let _ = device.create_shader_module(wgpu::ShaderModuleDescriptor { label: None, source: wgpu::ShaderSource::Wgsl("not wgsl".into()) });
}
/// The probed device keeps the adapter's own `max_texture_dimension_2d`, so a window
/// ballooned past 8192 px can still configure its surface. Needs an adapter; skipped
/// where there is none (CI without a GPU).
#[test]
fn probed_device_uses_adapter_max_texture_size() {
let Ok(setup) = probe(backend::window_backends(), false) else {
lightcraft_testkit::skip!(Gpu, "no GPU adapter");
return;
};
assert_eq!(
setup.device.limits().max_texture_dimension_2d,
setup.adapter.limits().max_texture_dimension_2d,
"the probed device must use the adapter's own max_texture_dimension_2d, not a fixed 8192 cap",
);
}
/// The workaround is opt-in and changes presentation only for Windows DX12.
#[test]
fn composition_only_changes_windows_dx12_presentation() {