Open History to see the last commit
1const INTEL_GPU_PATTERN = /intel|amd|radeon|nvidia|geforce/i;
2const APPLE_SILICON_GPU_PATTERN = /\bapple\s+m\d/i;
3
4export function macArchFromGpuRenderer(renderer: string): "arm64" | "x64" {
5 if (INTEL_GPU_PATTERN.test(renderer)) {
6 return "x64";
7 }
8 if (APPLE_SILICON_GPU_PATTERN.test(renderer)) {
9 return "arm64";
10 }
11
12 // Generic "Apple GPU" renderers are ambiguous on Safari. x64 is the safe
13 // fallback because Apple Silicon can run it through Rosetta, while Intel
14 // Macs cannot run an arm64 build.
15 return "x64";
16}