( mode: EngineConfig["browserGpuMode"], platform: NodeJS.Platform, )
| 705 | } |
| 706 | |
| 707 | function getBrowserGpuArgs( |
| 708 | mode: EngineConfig["browserGpuMode"], |
| 709 | platform: NodeJS.Platform, |
| 710 | ): string[] { |
| 711 | if (mode === "software") { |
| 712 | // Chrome 120+ deprecated implicit SwiftShader fallback; the explicit |
| 713 | // path (--use-angle=swiftshader) keeps working but Chrome emits a |
| 714 | // deprecation warning unless --enable-unsafe-swiftshader is also set. |
| 715 | // Despite the name, this is exactly the behaviour Chrome had before; |
| 716 | // the flag exists to make CPU rasterisation an explicit opt-in rather |
| 717 | // than an implicit fallback for end users on the open web. |
| 718 | return ["--use-gl=angle", "--use-angle=swiftshader", "--enable-unsafe-swiftshader"]; |
| 719 | } |
| 720 | |
| 721 | if (mode === "auto") { |
| 722 | // Should not reach here — `resolveBrowserGpuMode` collapses "auto" to |
| 723 | // "software" or "hardware" before args are built. Be defensive: software |
| 724 | // is the always-safe fallback. |
| 725 | return ["--use-gl=angle", "--use-angle=swiftshader", "--enable-unsafe-swiftshader"]; |
| 726 | } |
| 727 | |
| 728 | switch (platform) { |
| 729 | case "darwin": |
| 730 | return ["--use-gl=angle", "--use-angle=metal", "--enable-gpu-rasterization"]; |
| 731 | case "win32": |
| 732 | return ["--use-gl=angle", "--use-angle=d3d11", "--enable-gpu-rasterization"]; |
| 733 | case "linux": |
| 734 | // Chrome 131+ headless shell only accepts (gl=angle, angle=gl-egl); |
| 735 | // the old --use-gl=egl causes the GPU process to exit silently. |
| 736 | // --ignore-gpu-blocklist: the operator explicitly opted into |
| 737 | // browserGpuMode="hardware", so trust their driver/GPU choice. |
| 738 | return [ |
| 739 | "--use-gl=angle", |
| 740 | "--use-angle=gl-egl", |
| 741 | "--enable-gpu-rasterization", |
| 742 | "--ignore-gpu-blocklist", |
| 743 | "--disable-software-rasterizer", |
| 744 | ]; |
| 745 | default: |
| 746 | return ["--enable-gpu-rasterization"]; |
| 747 | } |
| 748 | } |
no outgoing calls
no test coverage detected