Skip to main content

effective_limits

Function effective_limits 

Source
pub fn effective_limits(base: Limits, is_ios_simulator: bool) -> Limits
Expand description

Given a base wgpu::Limits and whether the process is currently running on an iOS Simulator, decides the Limits a device request should actually use.

Mitigates wgpu #7057: the iOS Simulator is macOS-Metal-backed and requires 256-byte min_uniform_buffer_offset_alignment, but wgpu’s Metal backend reports the (lower) iOS-device value, which trips Metal API validation on the simulator. Physical iOS devices are unaffected and pass base through unchanged; a base whose alignment is already at or above 256 is left alone, never lowered.

Upstream gfx-rs/wgpu PR #10189 makes this unnecessary — drop it once a pinned wgpu release contains it.

Pure decision logic, mirroring effective_instance_flags’s split of pure decision vs. platform lookup. It is fed the profile-resolved base limits (see this module’s create_device) — the adapter’s own limits under DownlevelProfile::Full, the WebGL2 downlevel defaults resolution-folded with the adapter otherwise — so the device request never over-asks.