Skip to content

Commit 4d16003

Browse files
winit-wgpu: clamp requested device limits to the adapter
Requesting any limit above adapter support fails device creation outright, and downlevel adapters sit below the WebGPU defaults — the iOS simulator's emulated GPU offers max_inter_stage_shader_variables 15 vs the default 16, so the showcase died at request_device and the window stayed black. Clamp Limits::default() with or_worse_values_from(&adapter.limits()); on desktop-class GPUs the clamp is a no-op. The renderer's shaders use at most 8 inter-stage variables (max @location(7)), so degraded limits are validated where they actually bind: pipeline and resource creation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 93c419e commit 4d16003

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

  • crates/damascene-winit-wgpu/src

‎crates/damascene-winit-wgpu/src/lib.rs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,16 @@ impl<A: WinitWgpuApp> ApplicationHandler for Host<A> {
11141114
match pollster::block_on(adapter.request_device(&wgpu::DeviceDescriptor {
11151115
label: Some("damascene_winit_wgpu::device"),
11161116
required_features: wgpu::Features::empty(),
1117-
required_limits: wgpu::Limits::default(),
1117+
// Clamped to the adapter: requesting any limit above
1118+
// what the adapter supports fails device creation
1119+
// outright, and downlevel adapters sit below the
1120+
// WebGPU defaults (the iOS simulator's emulated GPU
1121+
// offers max_inter_stage_shader_variables 15 vs the
1122+
// default 16). The renderer's own shaders use at most
1123+
// 8 inter-stage variables, so degraded limits are
1124+
// validated where they actually bind: pipeline and
1125+
// resource creation.
1126+
required_limits: wgpu::Limits::default().or_worse_values_from(&adapter.limits()),
11181127
experimental_features: wgpu::ExperimentalFeatures::default(),
11191128
memory_hints: wgpu::MemoryHints::Performance,
11201129
trace: wgpu::Trace::Off,

0 commit comments

Comments
 (0)