Skip to content

Commit 3f05c05

Browse files
committed
Support Apple A15-A17 and M2 GPU (close #108)
See Soft8Soft/detect-gpu-js@c0e5bf0
1 parent 9e9ef38 commit 3f05c05

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/internal/deobfuscateAppleGPU.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ export function deobfuscateAppleGPU(
2929
const codeA = '801621810' as const;
3030
const codeB = '8016218135' as const;
3131
const codeC = '80162181161' as const;
32+
const codeFB = '80162181255';
3233

3334
// All chipsets that support at least iOS 12:
3435
const possibleChipsets: [
3536
string,
3637
typeof codeA | typeof codeB | typeof codeC,
37-
number
38+
number,
3839
][] = deviceInfo?.isIpad
3940
? [
4041
// ['a4', 5], // ipad 1st gen
@@ -66,12 +67,15 @@ export function deobfuscateAppleGPU(
6667
['a12', codeA, 15], // XS / XS Max / XR
6768
['a13', codeA, 15], // 11 / 11 pro / 11 pro max / se 2nd gen
6869
['a14', codeA, 15], // 12 / 12 mini / 12 pro / 12 pro max
70+
['a15', codeA, 15], // 13 / 13 mini / 13 pro / 13 pro max / se 3rd gen / 14 / 14 plus
71+
['a16', codeA, 15], // 14 pro / 14 pro max / 15 / 15 plus
72+
['a17', codeA, 15], // 15 pro / 15 pro max
6973
];
7074
let chipsets: typeof possibleChipsets;
7175

7276
// In iOS 14.x Apple started normalizing the outcome of this hack,
7377
// we use this fact to limit the list to devices that support ios 14+
74-
if (pixelId === '80162181255') {
78+
if (pixelId === codeFB) {
7579
chipsets = possibleChipsets.filter(([, , iosVersion]) => iosVersion >= 14);
7680
} else {
7781
chipsets = possibleChipsets.filter(([, id]) => id === pixelId);
@@ -82,7 +86,9 @@ export function deobfuscateAppleGPU(
8286
}
8387
const renderers = chipsets.map(([gpu]) => `apple ${gpu} gpu`);
8488
debug?.(
85-
`iOS 12.2+ obfuscates its GPU type and version, using closest matches: ${JSON.stringify(renderers)}`
89+
`iOS 12.2+ obfuscates its GPU type and version, using closest matches: ${JSON.stringify(
90+
renderers
91+
)}`
8692
);
8793
return renderers;
8894
}

0 commit comments

Comments
 (0)