Skip to content

Commit fa1717e

Browse files
authored
Avoid WebGPU on Safari (#9952)
1 parent 738bfd7 commit fa1717e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

crates/viewer/re_renderer/src/device_caps.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,8 @@ pub fn supported_backends() -> wgpu::Backends {
456456
// For changing the backend we use standard wgpu env var, i.e. WGPU_BACKEND.
457457
wgpu::Backends::from_env()
458458
.unwrap_or(wgpu::Backends::VULKAN | wgpu::Backends::METAL | wgpu::Backends::GL)
459+
} else if is_safari_browser() {
460+
wgpu::Backends::GL // TODO(#8559): Fix WebGPU on Safari
459461
} else {
460462
wgpu::Backends::GL | wgpu::Backends::BROWSER_WEBGPU
461463
}
@@ -529,3 +531,20 @@ pub fn validate_graphics_backend_applicability(backend: wgpu::Backend) -> Result
529531
}
530532
Ok(())
531533
}
534+
535+
/// Are we running inside the Safari browser?
536+
pub fn is_safari_browser() -> bool {
537+
#[cfg(target_arch = "wasm32")]
538+
fn is_safari_browser_inner() -> Option<bool> {
539+
use web_sys::wasm_bindgen::JsValue;
540+
let window = web_sys::window()?;
541+
Some(window.has_own_property(&JsValue::from("safari")))
542+
}
543+
544+
#[cfg(not(target_arch = "wasm32"))]
545+
fn is_safari_browser_inner() -> Option<bool> {
546+
None
547+
}
548+
549+
is_safari_browser_inner().unwrap_or(false)
550+
}

0 commit comments

Comments
 (0)