Skip to content

Avoid Firefox/macOS WebGPU shader failure by falling back to WebGL#191

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-shader-error-firefox-mac
Draft

Avoid Firefox/macOS WebGPU shader failure by falling back to WebGL#191
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-shader-error-firefox-mac

Conversation

Copilot AI commented May 9, 2026

Copy link
Copy Markdown

Firefox 146 on macOS can fail WebGPU pipeline compilation (Metal ... redefinition of '_tmp'), leaving the 3D canvas white. This change avoids that browser/OS-specific failure by selecting a safe rendering backend at engine init time.

  • Engine selection hardening

    • Added shouldUseWebGPUEngine(userAgent, platform) in babylon-jsview.directive.ts.
    • initEngine now uses:
      • WebGPU for all existing supported environments.
      • WebGL (Engine) specifically for Firefox on macOS.
    • Updated engine typing to support all runtime engine variants used by this directive (WebGPUEngine | Engine | NullEngine).
  • Targeted compatibility coverage

    • Extended babylon-jsview.directive.spec.ts with explicit assertions for:
      • Firefox + macOS → WebGPU disabled.
      • Firefox + non-macOS → WebGPU remains enabled.
export function shouldUseWebGPUEngine(userAgent: string, platform: string): boolean {
  const isFirefox = /firefox/i.test(userAgent);
  const isMac = /mac/i.test(platform);
  return !(isFirefox && isMac);
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1217/chrome-headless-shell-linux64/chrome-headless-shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1217/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,BoundaryEventDispatchTracksNodeRemoval,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,Transl -main/dist/ripgrep/bin/linux-x64/rg (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue May 9, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix shader error in Firefox on Mac Avoid Firefox/macOS WebGPU shader failure by falling back to WebGL May 9, 2026
Copilot AI requested a review from axeljaeger May 9, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shader Error using Firefox on Mac

2 participants