Skip to content

Commit 2aa7edc

Browse files
committed
fix(ios): request adapter.limits() in device-creation fallback
The 0.4.7 fallback used wgpu::Limits::default(), but some iOS GPUs cap individual limits (e.g. max_inter_stage_shader_variables) below wgpu's defaults, so request_device rejected the fallback too and the app still aborted on launch. Request adapter.limits() instead — exactly what the device reports — which request_device can never reject on limits. Validated in the iOS Simulator, which reproduces the same failure class (rejects 16>15 on max_inter_stage_shader_variables): the primary request fails, the fallback with adapter.limits() succeeds, and the game renders.
1 parent 2b1820e commit 2aa7edc

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

native/ios/src/lib.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,16 @@ unsafe extern "C" fn scene_will_connect(
365365
// configuration. The renderer keys off device.features() (see
366366
// renderer/mod.rs), so it transparently falls back to the non-RT
367367
// path when ray-query isn't granted.
368-
eprintln!("[bloom-ios] request_device with preferred features failed ({e:?}); retrying without ray-query/experimental features");
368+
eprintln!("[bloom-ios] request_device with preferred features failed ({e:?}); retrying with adapter limits and no ray-query/experimental features");
369+
// Request exactly the adapter's reported limits (not wgpu's
370+
// Limits::default()): some iOS GPUs cap individual limits — e.g.
371+
// max_inter_stage_shader_variables — below wgpu's defaults, so
372+
// request_device rejects the default-limits request too. Asking for
373+
// adapter.limits() can never exceed what the device supports.
369374
pollster_block_on(adapter.request_device(&wgpu::DeviceDescriptor {
370375
label: Some("bloom_device"),
371376
required_features: wgpu::Features::empty(),
372-
required_limits: wgpu::Limits::default(),
377+
required_limits: adapter.limits(),
373378
experimental_features: wgpu::ExperimentalFeatures::disabled(),
374379
..Default::default()
375380
})).expect("Failed to create device (minimal fallback)")
@@ -555,11 +560,16 @@ pub unsafe extern "C" fn perry_scene_will_connect(scene: *const c_void) {
555560
// configuration. The renderer keys off device.features() (see
556561
// renderer/mod.rs), so it transparently falls back to the non-RT
557562
// path when ray-query isn't granted.
558-
eprintln!("[bloom-ios] request_device with preferred features failed ({e:?}); retrying without ray-query/experimental features");
563+
eprintln!("[bloom-ios] request_device with preferred features failed ({e:?}); retrying with adapter limits and no ray-query/experimental features");
564+
// Request exactly the adapter's reported limits (not wgpu's
565+
// Limits::default()): some iOS GPUs cap individual limits — e.g.
566+
// max_inter_stage_shader_variables — below wgpu's defaults, so
567+
// request_device rejects the default-limits request too. Asking for
568+
// adapter.limits() can never exceed what the device supports.
559569
pollster_block_on(adapter.request_device(&wgpu::DeviceDescriptor {
560570
label: Some("bloom_device"),
561571
required_features: wgpu::Features::empty(),
562-
required_limits: wgpu::Limits::default(),
572+
required_limits: adapter.limits(),
563573
experimental_features: wgpu::ExperimentalFeatures::disabled(),
564574
..Default::default()
565575
})).expect("Failed to create device (minimal fallback)")

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bloomengine/engine",
3-
"version": "0.4.7",
3+
"version": "0.4.8",
44
"description": "Bloom Engine: native TypeScript game engine compiled by Perry",
55
"main": "src/index.ts",
66
"types": "src/index.ts",

0 commit comments

Comments
 (0)