@grepp/detect-gpu 5.0.83 → 5.0.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/benchmarks/d-amd.json +33 -10
- package/dist/benchmarks/d-geforce.json +20 -2
- package/dist/benchmarks/d-intel.json +16 -13
- package/dist/benchmarks/d-nvidia.json +27 -9
- package/dist/benchmarks/d-radeon.json +33 -10
- package/dist/benchmarks/m-adreno.json +3 -3
- package/dist/benchmarks/m-apple-ipad.json +4 -4
- package/dist/benchmarks/m-apple.json +8 -8
- package/dist/benchmarks/m-mali.json +4 -4
- package/dist/detect-gpu.esm.js +1 -1
- package/dist/detect-gpu.umd.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# Forked from [pmndrs/detect-gpu](https://github.com/pmndrs/detect-gpu)
|
2
2
|
|
3
|
+
Fixed the automatic update issue on detect-gpu
|
4
|
+
|
3
5
|
# Detect GPU
|
4
6
|
|
5
|
-
[](https://unpkg.com/detect-gpu)
|
7
|
-
[](https://packagephobia.now.sh/result?p=detect-gpu)
|
7
|
+
[](https://badge.fury.io/js/@grepp%2Fdetect-gpu)
|
8
8
|
|
9
9
|
Classifies GPUs based on their 3D rendering benchmark score allowing the developer to provide sensible default settings for graphically intensive applications. Think of it like a user-agent detection for the GPU but more powerful.
|
10
10
|
|
11
11
|
## Demo
|
12
12
|
|
13
|
-
[Live demo](https://
|
13
|
+
[Live demo](https://gistpreview.github.io/?d86f1681c364f614bd47a4079fb99ac8/detect-gpu-demo.html)
|
14
14
|
|
15
15
|
## Installation
|
16
16
|
|
@@ -19,13 +19,13 @@ By default we use the [UNPKG](https://unpkg.com) CDN to host the benchmark data.
|
|
19
19
|
Make sure you have [Node.js](http://nodejs.org/) installed.
|
20
20
|
|
21
21
|
```sh
|
22
|
-
$ npm install detect-gpu
|
22
|
+
$ npm install @grepp/detect-gpu
|
23
23
|
```
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
27
|
```ts
|
28
|
-
import { getGPUTier } from 'detect-gpu';
|
28
|
+
import { getGPUTier } from '@grepp/detect-gpu';
|
29
29
|
|
30
30
|
(async () => {
|
31
31
|
const gpuTier = await getGPUTier();
|
@@ -2948,6 +2948,24 @@
|
|
2948
2948
|
]
|
2949
2949
|
]
|
2950
2950
|
],
|
2951
|
+
[
|
2952
|
+
"amd radeon 8060s",
|
2953
|
+
"8060",
|
2954
|
+
"8060s amd radeon",
|
2955
|
+
0,
|
2956
|
+
[
|
2957
|
+
[
|
2958
|
+
1920,
|
2959
|
+
1080,
|
2960
|
+
60
|
2961
|
+
],
|
2962
|
+
[
|
2963
|
+
3840,
|
2964
|
+
2160,
|
2965
|
+
60
|
2966
|
+
]
|
2967
|
+
]
|
2968
|
+
],
|
2951
2969
|
[
|
2952
2970
|
"amd radeon 860m",
|
2953
2971
|
"860",
|
@@ -7389,7 +7407,7 @@
|
|
7389
7407
|
[
|
7390
7408
|
3360,
|
7391
7409
|
2100,
|
7392
|
-
|
7410
|
+
38
|
7393
7411
|
]
|
7394
7412
|
]
|
7395
7413
|
],
|
@@ -7736,11 +7754,6 @@
|
|
7736
7754
|
5120,
|
7737
7755
|
2880,
|
7738
7756
|
55
|
7739
|
-
],
|
7740
|
-
[
|
7741
|
-
5760,
|
7742
|
-
3240,
|
7743
|
-
52
|
7744
7757
|
]
|
7745
7758
|
]
|
7746
7759
|
],
|
@@ -8065,6 +8078,11 @@
|
|
8065
8078
|
2160,
|
8066
8079
|
60
|
8067
8080
|
],
|
8081
|
+
[
|
8082
|
+
4096,
|
8083
|
+
2304,
|
8084
|
+
60
|
8085
|
+
],
|
8068
8086
|
[
|
8069
8087
|
5120,
|
8070
8088
|
2880,
|
@@ -9060,6 +9078,11 @@
|
|
9060
9078
|
768,
|
9061
9079
|
14
|
9062
9080
|
],
|
9081
|
+
[
|
9082
|
+
1280,
|
9083
|
+
1024,
|
9084
|
+
24
|
9085
|
+
],
|
9063
9086
|
[
|
9064
9087
|
1920,
|
9065
9088
|
1080,
|
@@ -12065,9 +12088,9 @@
|
|
12065
12088
|
0,
|
12066
12089
|
[
|
12067
12090
|
[
|
12068
|
-
|
12069
|
-
|
12070
|
-
|
12091
|
+
1920,
|
12092
|
+
1080,
|
12093
|
+
1545
|
12071
12094
|
],
|
12072
12095
|
[
|
12073
12096
|
3840,
|
@@ -12155,7 +12178,7 @@
|
|
12155
12178
|
[
|
12156
12179
|
1920,
|
12157
12180
|
1080,
|
12158
|
-
|
12181
|
+
2286
|
12159
12182
|
],
|
12160
12183
|
[
|
12161
12184
|
3440,
|
@@ -5658,6 +5658,11 @@
|
|
5658
5658
|
1920,
|
5659
5659
|
1080,
|
5660
5660
|
693
|
5661
|
+
],
|
5662
|
+
[
|
5663
|
+
2560,
|
5664
|
+
1440,
|
5665
|
+
180
|
5661
5666
|
]
|
5662
5667
|
]
|
5663
5668
|
],
|
@@ -5981,7 +5986,7 @@
|
|
5981
5986
|
[
|
5982
5987
|
1920,
|
5983
5988
|
1080,
|
5984
|
-
|
5989
|
+
60
|
5985
5990
|
]
|
5986
5991
|
]
|
5987
5992
|
],
|
@@ -6101,6 +6106,19 @@
|
|
6101
6106
|
]
|
6102
6107
|
]
|
6103
6108
|
],
|
6109
|
+
[
|
6110
|
+
"nvidia geforce rtx 5050",
|
6111
|
+
"5050",
|
6112
|
+
"5050 geforce nvidia rtx",
|
6113
|
+
0,
|
6114
|
+
[
|
6115
|
+
[
|
6116
|
+
1920,
|
6117
|
+
1080,
|
6118
|
+
60
|
6119
|
+
]
|
6120
|
+
]
|
6121
|
+
],
|
6104
6122
|
[
|
6105
6123
|
"nvidia geforce rtx 5060",
|
6106
6124
|
"5060",
|
@@ -6141,7 +6159,7 @@
|
|
6141
6159
|
[
|
6142
6160
|
2560,
|
6143
6161
|
1440,
|
6144
|
-
|
6162
|
+
120
|
6145
6163
|
]
|
6146
6164
|
]
|
6147
6165
|
],
|
@@ -399,7 +399,7 @@
|
|
399
399
|
[
|
400
400
|
3840,
|
401
401
|
2160,
|
402
|
-
|
402
|
+
137
|
403
403
|
]
|
404
404
|
]
|
405
405
|
],
|
@@ -447,6 +447,19 @@
|
|
447
447
|
]
|
448
448
|
]
|
449
449
|
],
|
450
|
+
[
|
451
|
+
"intel arc pro b60",
|
452
|
+
"60",
|
453
|
+
"arc b60 intel pro",
|
454
|
+
0,
|
455
|
+
[
|
456
|
+
[
|
457
|
+
2560,
|
458
|
+
1440,
|
459
|
+
158
|
460
|
+
]
|
461
|
+
]
|
462
|
+
],
|
450
463
|
[
|
451
464
|
"intel broxton-p hd",
|
452
465
|
"p",
|
@@ -2720,11 +2733,6 @@
|
|
2720
2733
|
1920,
|
2721
2734
|
1080,
|
2722
2735
|
149
|
2723
|
-
],
|
2724
|
-
[
|
2725
|
-
1920,
|
2726
|
-
1200,
|
2727
|
-
59
|
2728
2736
|
]
|
2729
2737
|
]
|
2730
2738
|
],
|
@@ -3253,7 +3261,7 @@
|
|
3253
3261
|
[
|
3254
3262
|
1366,
|
3255
3263
|
768,
|
3256
|
-
|
3264
|
+
27
|
3257
3265
|
],
|
3258
3266
|
[
|
3259
3267
|
1920,
|
@@ -3441,11 +3449,6 @@
|
|
3441
3449
|
1440,
|
3442
3450
|
26
|
3443
3451
|
],
|
3444
|
-
[
|
3445
|
-
2688,
|
3446
|
-
1680,
|
3447
|
-
34
|
3448
|
-
],
|
3449
3452
|
[
|
3450
3453
|
3440,
|
3451
3454
|
1440,
|
@@ -3454,7 +3457,7 @@
|
|
3454
3457
|
[
|
3455
3458
|
3584,
|
3456
3459
|
2240,
|
3457
|
-
|
3460
|
+
60
|
3458
3461
|
],
|
3459
3462
|
[
|
3460
3463
|
3840,
|
@@ -5897,6 +5897,11 @@
|
|
5897
5897
|
1920,
|
5898
5898
|
1080,
|
5899
5899
|
693
|
5900
|
+
],
|
5901
|
+
[
|
5902
|
+
2560,
|
5903
|
+
1440,
|
5904
|
+
180
|
5900
5905
|
]
|
5901
5906
|
]
|
5902
5907
|
],
|
@@ -6220,7 +6225,7 @@
|
|
6220
6225
|
[
|
6221
6226
|
1920,
|
6222
6227
|
1080,
|
6223
|
-
|
6228
|
+
60
|
6224
6229
|
]
|
6225
6230
|
]
|
6226
6231
|
],
|
@@ -6340,6 +6345,19 @@
|
|
6340
6345
|
]
|
6341
6346
|
]
|
6342
6347
|
],
|
6348
|
+
[
|
6349
|
+
"nvidia geforce rtx 5050",
|
6350
|
+
"5050",
|
6351
|
+
"5050 geforce nvidia rtx",
|
6352
|
+
0,
|
6353
|
+
[
|
6354
|
+
[
|
6355
|
+
1920,
|
6356
|
+
1080,
|
6357
|
+
60
|
6358
|
+
]
|
6359
|
+
]
|
6360
|
+
],
|
6343
6361
|
[
|
6344
6362
|
"nvidia geforce rtx 5060",
|
6345
6363
|
"5060",
|
@@ -6380,7 +6398,7 @@
|
|
6380
6398
|
[
|
6381
6399
|
2560,
|
6382
6400
|
1440,
|
6383
|
-
|
6401
|
+
120
|
6384
6402
|
]
|
6385
6403
|
]
|
6386
6404
|
],
|
@@ -9513,15 +9531,15 @@
|
|
9513
9531
|
768,
|
9514
9532
|
57
|
9515
9533
|
],
|
9534
|
+
[
|
9535
|
+
1920,
|
9536
|
+
1080,
|
9537
|
+
36
|
9538
|
+
],
|
9516
9539
|
[
|
9517
9540
|
2560,
|
9518
9541
|
1440,
|
9519
9542
|
19
|
9520
|
-
],
|
9521
|
-
[
|
9522
|
-
3840,
|
9523
|
-
2160,
|
9524
|
-
10
|
9525
9543
|
]
|
9526
9544
|
]
|
9527
9545
|
],
|
@@ -10795,8 +10813,8 @@
|
|
10795
10813
|
0,
|
10796
10814
|
[
|
10797
10815
|
[
|
10798
|
-
|
10799
|
-
|
10816
|
+
1920,
|
10817
|
+
1200,
|
10800
10818
|
60
|
10801
10819
|
]
|
10802
10820
|
]
|
@@ -986,6 +986,24 @@
|
|
986
986
|
]
|
987
987
|
]
|
988
988
|
],
|
989
|
+
[
|
990
|
+
"amd radeon 8060s",
|
991
|
+
"8060",
|
992
|
+
"8060s amd radeon",
|
993
|
+
0,
|
994
|
+
[
|
995
|
+
[
|
996
|
+
1920,
|
997
|
+
1080,
|
998
|
+
60
|
999
|
+
],
|
1000
|
+
[
|
1001
|
+
3840,
|
1002
|
+
2160,
|
1003
|
+
60
|
1004
|
+
]
|
1005
|
+
]
|
1006
|
+
],
|
989
1007
|
[
|
990
1008
|
"amd radeon 860m",
|
991
1009
|
"860",
|
@@ -5427,7 +5445,7 @@
|
|
5427
5445
|
[
|
5428
5446
|
3360,
|
5429
5447
|
2100,
|
5430
|
-
|
5448
|
+
38
|
5431
5449
|
]
|
5432
5450
|
]
|
5433
5451
|
],
|
@@ -5774,11 +5792,6 @@
|
|
5774
5792
|
5120,
|
5775
5793
|
2880,
|
5776
5794
|
55
|
5777
|
-
],
|
5778
|
-
[
|
5779
|
-
5760,
|
5780
|
-
3240,
|
5781
|
-
52
|
5782
5795
|
]
|
5783
5796
|
]
|
5784
5797
|
],
|
@@ -6103,6 +6116,11 @@
|
|
6103
6116
|
2160,
|
6104
6117
|
60
|
6105
6118
|
],
|
6119
|
+
[
|
6120
|
+
4096,
|
6121
|
+
2304,
|
6122
|
+
60
|
6123
|
+
],
|
6106
6124
|
[
|
6107
6125
|
5120,
|
6108
6126
|
2880,
|
@@ -7098,6 +7116,11 @@
|
|
7098
7116
|
768,
|
7099
7117
|
14
|
7100
7118
|
],
|
7119
|
+
[
|
7120
|
+
1280,
|
7121
|
+
1024,
|
7122
|
+
24
|
7123
|
+
],
|
7101
7124
|
[
|
7102
7125
|
1920,
|
7103
7126
|
1080,
|
@@ -10103,9 +10126,9 @@
|
|
10103
10126
|
0,
|
10104
10127
|
[
|
10105
10128
|
[
|
10106
|
-
|
10107
|
-
|
10108
|
-
|
10129
|
+
1920,
|
10130
|
+
1080,
|
10131
|
+
1545
|
10109
10132
|
],
|
10110
10133
|
[
|
10111
10134
|
3840,
|
@@ -10193,7 +10216,7 @@
|
|
10193
10216
|
[
|
10194
10217
|
1920,
|
10195
10218
|
1080,
|
10196
|
-
|
10219
|
+
2286
|
10197
10220
|
],
|
10198
10221
|
[
|
10199
10222
|
3440,
|
@@ -2249,8 +2249,8 @@
|
|
2249
2249
|
[
|
2250
2250
|
2178,
|
2251
2251
|
1080,
|
2252
|
-
|
2253
|
-
"samsung galaxy s20 5g
|
2252
|
+
60,
|
2253
|
+
"samsung galaxy s20 5g"
|
2254
2254
|
],
|
2255
2255
|
[
|
2256
2256
|
2196,
|
@@ -2279,7 +2279,7 @@
|
|
2279
2279
|
[
|
2280
2280
|
2320,
|
2281
2281
|
1080,
|
2282
|
-
|
2282
|
+
110,
|
2283
2283
|
"xiaomi redmi k40"
|
2284
2284
|
],
|
2285
2285
|
[
|
@@ -190,7 +190,7 @@
|
|
190
190
|
2266,
|
191
191
|
1488,
|
192
192
|
60,
|
193
|
-
"apple ipad mini (a17)"
|
193
|
+
"apple ipad mini 7th gen cellular (a17)"
|
194
194
|
]
|
195
195
|
]
|
196
196
|
],
|
@@ -279,7 +279,7 @@
|
|
279
279
|
[
|
280
280
|
2360,
|
281
281
|
1640,
|
282
|
-
|
282
|
+
60,
|
283
283
|
"apple ipad air (5th generation)"
|
284
284
|
],
|
285
285
|
[
|
@@ -357,8 +357,8 @@
|
|
357
357
|
[
|
358
358
|
2420,
|
359
359
|
1668,
|
360
|
-
|
361
|
-
"apple ipad pro 11
|
360
|
+
120,
|
361
|
+
"apple ipad pro 11-inch (m4)"
|
362
362
|
],
|
363
363
|
[
|
364
364
|
2752,
|
@@ -67,7 +67,7 @@
|
|
67
67
|
[
|
68
68
|
2436,
|
69
69
|
1125,
|
70
|
-
|
70
|
+
61,
|
71
71
|
"apple iphone xs"
|
72
72
|
],
|
73
73
|
[
|
@@ -105,7 +105,7 @@
|
|
105
105
|
[
|
106
106
|
2436,
|
107
107
|
1125,
|
108
|
-
|
108
|
+
61,
|
109
109
|
"apple iphone 11 pro"
|
110
110
|
],
|
111
111
|
[
|
@@ -157,7 +157,7 @@
|
|
157
157
|
[
|
158
158
|
1334,
|
159
159
|
750,
|
160
|
-
|
160
|
+
118,
|
161
161
|
"apple iphone se (2022)"
|
162
162
|
],
|
163
163
|
[
|
@@ -169,8 +169,8 @@
|
|
169
169
|
[
|
170
170
|
2532,
|
171
171
|
1170,
|
172
|
-
|
173
|
-
"apple iphone 13
|
172
|
+
33,
|
173
|
+
"apple iphone 13"
|
174
174
|
],
|
175
175
|
[
|
176
176
|
2778,
|
@@ -196,7 +196,7 @@
|
|
196
196
|
2778,
|
197
197
|
1284,
|
198
198
|
60,
|
199
|
-
"apple iphone
|
199
|
+
"apple iphone 15 plus"
|
200
200
|
]
|
201
201
|
]
|
202
202
|
],
|
@@ -215,7 +215,7 @@
|
|
215
215
|
[
|
216
216
|
2778,
|
217
217
|
1284,
|
218
|
-
|
218
|
+
60,
|
219
219
|
"apple iphone 15 pro max"
|
220
220
|
]
|
221
221
|
]
|
@@ -229,7 +229,7 @@
|
|
229
229
|
[
|
230
230
|
2532,
|
231
231
|
1170,
|
232
|
-
|
232
|
+
60,
|
233
233
|
"apple iphone 16 (iphone17,5)"
|
234
234
|
],
|
235
235
|
[
|
@@ -237,7 +237,7 @@
|
|
237
237
|
"samsung galaxy m33"
|
238
238
|
],
|
239
239
|
[
|
240
|
-
|
240
|
+
2408,
|
241
241
|
1080,
|
242
242
|
34,
|
243
243
|
"samsung galaxy a14 5g"
|
@@ -681,9 +681,9 @@
|
|
681
681
|
0,
|
682
682
|
[
|
683
683
|
[
|
684
|
-
|
685
|
-
|
686
|
-
|
684
|
+
2486,
|
685
|
+
1264,
|
686
|
+
90,
|
687
687
|
"oppo find x8 pro"
|
688
688
|
],
|
689
689
|
[
|
package/dist/detect-gpu.esm.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
function e(e,t,r,n){return new(r||(r=Promise))(function(o,a){function i(e){try{d(n.next(e))}catch(e){a(e)}}function c(e){try{d(n.throw(e))}catch(e){a(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,c)}d((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const t=["geforce 320m","geforce 8600","geforce 8600m gt","geforce 8800 gs","geforce 8800 gt","geforce 9400","geforce 9400m g","geforce 9400m","geforce 9600m gt","geforce 9600m","geforce fx go5200","geforce gt 120","geforce gt 130","geforce gt 330m","geforce gtx 285","google swiftshader","intel g41","intel g45","intel gma 4500mhd","intel gma x3100","intel hd 3000","intel q45","legacy","mali-2","mali-3","mali-4","quadro fx 1500","quadro fx 4","quadro fx 5","radeon hd 2400","radeon hd 2600","radeon hd 4670","radeon hd 4850","radeon hd 4870","radeon hd 5670","radeon hd 5750","radeon hd 6290","radeon hd 6300","radeon hd 6310","radeon hd 6320","radeon hd 6490m","radeon hd 6630m","radeon hd 6750m","radeon hd 6770m","radeon hd 6970m","sgx 543","sgx543"];function r(e){return e=e.toLowerCase().replace(/.*angle ?\((.+)\)(?: on vulkan [0-9.]+)?$/i,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"").replace(/(?:vulkan|opengl) \d+\.\d+(?:\.\d+)?(?: \((.*)\))?/,"$1")}const n=34962,o="undefined"==typeof window,a=(()=>{if(o)return;const{userAgent:e,platform:t,maxTouchPoints:r}=window.navigator,n=/(iphone|ipod|ipad)/i.test(e),a="iPad"===t||"MacIntel"===t&&r>0&&!window.MSStream;return{isIpad:a,isMobile:/android/i.test(e)||n||a,isSafari12:/Version\/12.+Safari/.test(e),isFirefox:/Firefox/.test(e)}})();function i(e,t,r){if(!r)return[t];const o=function(e){const t="\n precision highp float;\n attribute vec3 aPosition;\n varying float vvv;\n void main() {\n vvv = 0.31622776601683794;\n gl_Position = vec4(aPosition, 1.0);\n }\n ",r="\n precision highp float;\n varying float vvv;\n void main() {\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * vvv;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n gl_FragColor = enc;\n }\n ",o=e.createShader(35633),a=e.createShader(35632),i=e.createProgram();if(!(a&&o&&i))return;e.shaderSource(o,t),e.shaderSource(a,r),e.compileShader(o),e.compileShader(a),e.attachShader(i,o),e.attachShader(i,a),e.linkProgram(i),e.detachShader(i,o),e.detachShader(i,a),e.deleteShader(o),e.deleteShader(a),e.useProgram(i);const c=e.createBuffer();e.bindBuffer(n,c),e.bufferData(n,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);const d=e.getAttribLocation(i,"aPosition");e.vertexAttribPointer(d,3,5126,!1,0,0),e.enableVertexAttribArray(d),e.clearColor(1,1,1,1),e.clear(16384),e.viewport(0,0,1,1),e.drawArrays(4,0,3);const l=new Uint8Array(4);return e.readPixels(0,0,1,1,6408,5121,l),e.deleteProgram(i),e.deleteBuffer(c),l.join("")}(e),i="801621810",c="8016218135",d="80162181161",l=(null==a?void 0:a.isIpad)?[["a7",d,12],["a8",c,15],["a8x",c,15],["a9",c,15],["a9x",c,15],["a10",c,15],["a10x",c,15],["a12",i,15],["a12x",i,15],["a12z",i,15],["a14",i,15],["a15",i,15],["m1",i,15],["m2",i,15]]:[["a7",d,12],["a8",c,12],["a9",c,15],["a10",c,15],["a11",i,15],["a12",i,15],["a13",i,15],["a14",i,15],["a15",i,15],["a16",i,15],["a17",i,15]];let s;"80162181255"===o?s=l.filter(([,,e])=>e>=14):(s=l.filter(([,e])=>e===o),s.length||(s=l));return s.map(([e])=>`apple ${e} gpu`)}class c extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const d=[],l=[];function s(e,t){if(e===t)return 0;const r=e;e.length>t.length&&(e=t,t=r);let n=e.length,o=t.length;for(;n>0&&e.charCodeAt(~-n)===t.charCodeAt(~-o);)n--,o--;let a,i=0;for(;i<n&&e.charCodeAt(i)===t.charCodeAt(i);)i++;if(n-=i,o-=i,0===n)return o;let c,s,f=0,u=0,g=0;for(;u<n;)l[u]=e.charCodeAt(i+u),d[u]=++u;for(;g<o;)for(a=t.charCodeAt(i+g),c=g++,f=g,u=0;u<n;u++)s=a===l[u]?c:c+1,c=d[u],f=d[u]=c>f?s>f?f+1:s:s>c?c+1:s;return f}function f(e){return null!=e}const u=(...n)=>e(void 0,[...n],void 0,function*({mobileTiers:n=[0,15,30,60],desktopTiers:d=[0,15,30,60],override:l={},glContext:u,failIfMajorPerformanceCaveat:g=!1,benchmarksURL:h="https://unpkg.com/@grepp/detect-gpu@5.0.
|
1
|
+
function e(e,t,r,n){return new(r||(r=Promise))(function(o,a){function i(e){try{d(n.next(e))}catch(e){a(e)}}function c(e){try{d(n.throw(e))}catch(e){a(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(i,c)}d((n=n.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const t=["geforce 320m","geforce 8600","geforce 8600m gt","geforce 8800 gs","geforce 8800 gt","geforce 9400","geforce 9400m g","geforce 9400m","geforce 9600m gt","geforce 9600m","geforce fx go5200","geforce gt 120","geforce gt 130","geforce gt 330m","geforce gtx 285","google swiftshader","intel g41","intel g45","intel gma 4500mhd","intel gma x3100","intel hd 3000","intel q45","legacy","mali-2","mali-3","mali-4","quadro fx 1500","quadro fx 4","quadro fx 5","radeon hd 2400","radeon hd 2600","radeon hd 4670","radeon hd 4850","radeon hd 4870","radeon hd 5670","radeon hd 5750","radeon hd 6290","radeon hd 6300","radeon hd 6310","radeon hd 6320","radeon hd 6490m","radeon hd 6630m","radeon hd 6750m","radeon hd 6770m","radeon hd 6970m","sgx 543","sgx543"];function r(e){return e=e.toLowerCase().replace(/.*angle ?\((.+)\)(?: on vulkan [0-9.]+)?$/i,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"").replace(/(?:vulkan|opengl) \d+\.\d+(?:\.\d+)?(?: \((.*)\))?/,"$1")}const n=34962,o="undefined"==typeof window,a=(()=>{if(o)return;const{userAgent:e,platform:t,maxTouchPoints:r}=window.navigator,n=/(iphone|ipod|ipad)/i.test(e),a="iPad"===t||"MacIntel"===t&&r>0&&!window.MSStream;return{isIpad:a,isMobile:/android/i.test(e)||n||a,isSafari12:/Version\/12.+Safari/.test(e),isFirefox:/Firefox/.test(e)}})();function i(e,t,r){if(!r)return[t];const o=function(e){const t="\n precision highp float;\n attribute vec3 aPosition;\n varying float vvv;\n void main() {\n vvv = 0.31622776601683794;\n gl_Position = vec4(aPosition, 1.0);\n }\n ",r="\n precision highp float;\n varying float vvv;\n void main() {\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * vvv;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n gl_FragColor = enc;\n }\n ",o=e.createShader(35633),a=e.createShader(35632),i=e.createProgram();if(!(a&&o&&i))return;e.shaderSource(o,t),e.shaderSource(a,r),e.compileShader(o),e.compileShader(a),e.attachShader(i,o),e.attachShader(i,a),e.linkProgram(i),e.detachShader(i,o),e.detachShader(i,a),e.deleteShader(o),e.deleteShader(a),e.useProgram(i);const c=e.createBuffer();e.bindBuffer(n,c),e.bufferData(n,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);const d=e.getAttribLocation(i,"aPosition");e.vertexAttribPointer(d,3,5126,!1,0,0),e.enableVertexAttribArray(d),e.clearColor(1,1,1,1),e.clear(16384),e.viewport(0,0,1,1),e.drawArrays(4,0,3);const l=new Uint8Array(4);return e.readPixels(0,0,1,1,6408,5121,l),e.deleteProgram(i),e.deleteBuffer(c),l.join("")}(e),i="801621810",c="8016218135",d="80162181161",l=(null==a?void 0:a.isIpad)?[["a7",d,12],["a8",c,15],["a8x",c,15],["a9",c,15],["a9x",c,15],["a10",c,15],["a10x",c,15],["a12",i,15],["a12x",i,15],["a12z",i,15],["a14",i,15],["a15",i,15],["m1",i,15],["m2",i,15]]:[["a7",d,12],["a8",c,12],["a9",c,15],["a10",c,15],["a11",i,15],["a12",i,15],["a13",i,15],["a14",i,15],["a15",i,15],["a16",i,15],["a17",i,15]];let s;"80162181255"===o?s=l.filter(([,,e])=>e>=14):(s=l.filter(([,e])=>e===o),s.length||(s=l));return s.map(([e])=>`apple ${e} gpu`)}class c extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const d=[],l=[];function s(e,t){if(e===t)return 0;const r=e;e.length>t.length&&(e=t,t=r);let n=e.length,o=t.length;for(;n>0&&e.charCodeAt(~-n)===t.charCodeAt(~-o);)n--,o--;let a,i=0;for(;i<n&&e.charCodeAt(i)===t.charCodeAt(i);)i++;if(n-=i,o-=i,0===n)return o;let c,s,f=0,u=0,g=0;for(;u<n;)l[u]=e.charCodeAt(i+u),d[u]=++u;for(;g<o;)for(a=t.charCodeAt(i+g),c=g++,f=g,u=0;u<n;u++)s=a===l[u]?c:c+1,c=d[u],f=d[u]=c>f?s>f?f+1:s:s>c?c+1:s;return f}function f(e){return null!=e}const u=(...n)=>e(void 0,[...n],void 0,function*({mobileTiers:n=[0,15,30,60],desktopTiers:d=[0,15,30,60],override:l={},glContext:u,failIfMajorPerformanceCaveat:g=!1,benchmarksURL:h="https://unpkg.com/@grepp/detect-gpu@5.0.84/dist/benchmarks"}={}){const p={};if(o)return{tier:0,type:"SSR"};const{isIpad:m=!!(null==a?void 0:a.isIpad),isMobile:v=!!(null==a?void 0:a.isMobile),screenSize:w=window.screen,loadBenchmarks:x=t=>e(void 0,void 0,void 0,function*(){const e=yield fetch(`${h}/${t}`).then(e=>e.json());if(parseInt(e.shift().split(".")[0],10)<4)throw new c("Detect GPU benchmark data is out of date. Please update to version 4x");return e})}=l;let{renderer:A}=l;const P=(e,t,r,n,o)=>({device:o,fps:n,gpu:r,isMobile:v,tier:e,type:t});let S,b="";if(A)A=r(A),S=[A];else{const e=u||function(e,t=!1){const r={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:t,powerPreference:"high-performance",stencil:!1};e&&delete r.powerPreference;const n=window.document.createElement("canvas"),o=n.getContext("webgl",r)||n.getContext("experimental-webgl",r);return null!=o?o:void 0}(null==a?void 0:a.isSafari12,g);if(!e)return P(0,"WEBGL_UNSUPPORTED");const t=(null==a?void 0:a.isFirefox)?null:e.getExtension("WEBGL_debug_renderer_info");if(A=t?e.getParameter(t.UNMASKED_RENDERER_WEBGL):e.getParameter(e.RENDERER),!A)return P(1,"FALLBACK");b=A,A=r(A),S=function(e,t,r){return"apple gpu"===t?i(e,t,r):[t]}(e,A,v)}const E=(yield Promise.all(S.map(function(t){return e(this,void 0,void 0,function*(){var e;const r=(e=>{const t=v?["adreno","apple","mali-t","mali","nvidia","powervr","samsung"]:["intel","apple","amd","radeon","nvidia","geforce","adreno"];for(const r of t)if(e.includes(r))return r})(t);if(!r)return;const n=`${v?"m":"d"}-${r}${m?"-ipad":""}.json`,o=p[n]=null!==(e=p[n])&&void 0!==e?e:x(n);let a;try{a=yield o}catch(e){if(e instanceof c)throw e;return}const i=function(e){var t;const r=(e=e.replace(/\([^)]+\)/,"")).match(/\d+/)||e.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return null!==(t=null==r?void 0:r.join("").replace(/\W|amd/g,""))&&void 0!==t?t:""}(t);let d=a.filter(([,e])=>e===i);d.length||(d=a.filter(([e])=>e.includes(t)));const l=d.length;if(0===l)return;const f=t.split(/[.,()\[\]/\s]/g).sort().filter((e,t,r)=>0===t||e!==r[t-1]).join(" ");let u,[g,,,,h]=l>1?d.map(e=>[e,s(f,e[2])]).sort(([,e],[,t])=>e-t)[0][0]:d[0],A=Number.MAX_VALUE;const{devicePixelRatio:P}=window,S=w.width*P*w.height*P;for(const e of h){const[t,r]=e,n=t*r,o=Math.abs(S-n);o<A&&(A=o,u=e)}if(!u)return;const[,,b,E]=u;return[A,b,g,E]})}))).filter(f).sort(([e=Number.MAX_VALUE,t],[r=Number.MAX_VALUE,n])=>e===r?t-n:e-r);if(!E.length){const e=t.find(e=>A.includes(e));return e?P(0,"BLOCKLISTED",e):P(1,"FALLBACK",`${A} (${b})`)}const[,y,C,L]=E[0];if(-1===y)return P(0,"BLOCKLISTED",C,y,L);const M=v?n:d;let $=0;for(let e=0;e<M.length;e++)y>=M[e]&&($=e);return P($,"BENCHMARK",C,y,L)});export{u as getGPUTier};
|
2
2
|
//# sourceMappingURL=detect-gpu.esm.js.map
|
package/dist/detect-gpu.umd.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).DetectGPU={})}(this,function(e){"use strict";var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},r(e,t)};function t(e,r,t,n){return new(t||(t=Promise))(function(o,a){function i(e){try{u(n.next(e))}catch(e){a(e)}}function c(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t(function(e){e(r)})).then(i,c)}u((n=n.apply(e,r||[])).next())})}function n(e,r){var t,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=c(0),i.throw=c(1),i.return=c(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(u){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(t=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=r.call(e,a)}catch(e){c=[6,e],n=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}}"function"==typeof SuppressedError&&SuppressedError;var o=["geforce 320m","geforce 8600","geforce 8600m gt","geforce 8800 gs","geforce 8800 gt","geforce 9400","geforce 9400m g","geforce 9400m","geforce 9600m gt","geforce 9600m","geforce fx go5200","geforce gt 120","geforce gt 130","geforce gt 330m","geforce gtx 285","google swiftshader","intel g41","intel g45","intel gma 4500mhd","intel gma x3100","intel hd 3000","intel q45","legacy","mali-2","mali-3","mali-4","quadro fx 1500","quadro fx 4","quadro fx 5","radeon hd 2400","radeon hd 2600","radeon hd 4670","radeon hd 4850","radeon hd 4870","radeon hd 5670","radeon hd 5750","radeon hd 6290","radeon hd 6300","radeon hd 6310","radeon hd 6320","radeon hd 6490m","radeon hd 6630m","radeon hd 6750m","radeon hd 6770m","radeon hd 6970m","sgx 543","sgx543"];function a(e){return e=e.toLowerCase().replace(/.*angle ?\((.+)\)(?: on vulkan [0-9.]+)?$/i,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"").replace(/(?:vulkan|opengl) \d+\.\d+(?:\.\d+)?(?: \((.*)\))?/,"$1")}const i=34962;var c="undefined"==typeof window,u=function(){if(!c){var e=window.navigator,r=e.userAgent,t=e.platform,n=e.maxTouchPoints,o=/(iphone|ipod|ipad)/i.test(r),a="iPad"===t||"MacIntel"===t&&n>0&&!window.MSStream;return{isIpad:a,isMobile:/android/i.test(r)||o||a,isSafari12:/Version\/12.+Safari/.test(r),isFirefox:/Firefox/.test(r)}}}();function l(e,r,t){if(!t)return[r];var n,o=function(e){var r="\n precision highp float;\n attribute vec3 aPosition;\n varying float vvv;\n void main() {\n vvv = 0.31622776601683794;\n gl_Position = vec4(aPosition, 1.0);\n }\n ",t="\n precision highp float;\n varying float vvv;\n void main() {\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * vvv;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n gl_FragColor = enc;\n }\n ",n=e.createShader(35633),o=e.createShader(35632),a=e.createProgram();if(!(o&&n&&a))return;e.shaderSource(n,r),e.shaderSource(o,t),e.compileShader(n),e.compileShader(o),e.attachShader(a,n),e.attachShader(a,o),e.linkProgram(a),e.detachShader(a,n),e.detachShader(a,o),e.deleteShader(n),e.deleteShader(o),e.useProgram(a);var c=e.createBuffer();e.bindBuffer(i,c),e.bufferData(i,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);var u=e.getAttribLocation(a,"aPosition");e.vertexAttribPointer(u,3,5126,!1,0,0),e.enableVertexAttribArray(u),e.clearColor(1,1,1,1),e.clear(16384),e.viewport(0,0,1,1),e.drawArrays(4,0,3);var l=new Uint8Array(4);return e.readPixels(0,0,1,1,6408,5121,l),e.deleteProgram(a),e.deleteBuffer(c),l.join("")}(e),a="801621810",c="8016218135",l="80162181161",f=(null==u?void 0:u.isIpad)?[["a7",l,12],["a8",c,15],["a8x",c,15],["a9",c,15],["a9x",c,15],["a10",c,15],["a10x",c,15],["a12",a,15],["a12x",a,15],["a12z",a,15],["a14",a,15],["a15",a,15],["m1",a,15],["m2",a,15]]:[["a7",l,12],["a8",c,12],["a9",c,15],["a10",c,15],["a11",a,15],["a12",a,15],["a13",a,15],["a14",a,15],["a15",a,15],["a16",a,15],["a17",a,15]];return"80162181255"===o?n=f.filter(function(e){return e[2]>=14}):(n=f.filter(function(e){return e[1]===o})).length||(n=f),n.map(function(e){var r=e[0];return"apple ".concat(r," gpu")})}var f=function(e){function t(r){var t=this.constructor,n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t}(Error);var d=[],s=[];function h(e,r){if(e===r)return 0;var t=e;e.length>r.length&&(e=r,r=t);for(var n=e.length,o=r.length;n>0&&e.charCodeAt(~-n)===r.charCodeAt(~-o);)n--,o--;for(var a,i=0;i<n&&e.charCodeAt(i)===r.charCodeAt(i);)i++;if(o-=i,0===(n-=i))return o;for(var c,u,l=0,f=0,h=0;f<n;)s[f]=e.charCodeAt(i+f),d[f]=++f;for(;h<o;)for(a=r.charCodeAt(i+h),c=h++,l=h,f=0;f<n;f++)u=a===s[f]?c:c+1,c=d[f],l=d[f]=c>l?u>l?l+1:u:u>c?c+1:u;return l}function p(e){return null!=e}e.getGPUTier=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t(void 0,function(e,r,t){if(t||2===arguments.length)for(var n,o=0,a=r.length;o<a;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))}([],e,!0),void 0,function(e){function r(e){return t(this,void 0,void 0,function(){var r,t,o,a,c,u,l,d,p,v,m,y,x,P,S,E,C,_,L,j,M,k,B,I,O,R,T;return n(this,function(n){switch(n.label){case 0:if(!(r=A(e)))return[2];t="".concat(g?"m":"d","-").concat(r).concat(s?"-ipad":"",".json"),o=i[t]=null!==(T=i[t])&&void 0!==T?T:w(t),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,o];case 2:return a=n.sent(),[3,4];case 3:if((c=n.sent())instanceof f)throw c;return[2];case 4:if(u=function(e){var r,t=(e=e.replace(/\([^)]+\)/,"")).match(/\d+/)||e.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return null!==(r=null==t?void 0:t.join("").replace(/\W|amd/g,""))&&void 0!==r?r:""}(e),l=a.filter(function(e){return e[1]===u}),l.length||(l=a.filter(function(r){return r[0].includes(e)})),0===(d=l.length))return[2];for(p=e.split(/[.,()\[\]/\s]/g).sort().filter(function(e,r,t){return 0===r||e!==t[r-1]}).join(" "),v=d>1?l.map(function(e){return[e,h(p,e[2])]}).sort(function(e,r){return e[1]-r[1]})[0][0]:l[0],m=v[0],y=v[4],x=Number.MAX_VALUE,S=window.devicePixelRatio,E=b.width*S*b.height*S,C=0,_=y;C<_.length;C++)L=_[C],j=L[0],M=L[1],k=j*M,(B=Math.abs(E-k))<x&&(x=B,P=L);return P?(O=(I=P)[2],R=I[3],[2,[x,O,m,R]]):[2]}})})}var i,d,s,v,g,m,b,y,w,x,A,P,S,E,C,_,L,j,M,k,B,I,O,R,T,U=void 0===e?{}:e,D=U.mobileTiers,N=void 0===D?[0,15,30,60]:D,F=U.desktopTiers,G=void 0===F?[0,15,30,60]:F,K=U.override,W=void 0===K?{}:K,$=U.glContext,V=U.failIfMajorPerformanceCaveat,q=void 0!==V&&V,z=U.benchmarksURL,X=void 0===z?"https://unpkg.com/@grepp/detect-gpu@".concat("5.0.
|
1
|
+
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).DetectGPU={})}(this,function(e){"use strict";var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])},r(e,t)};function t(e,r,t,n){return new(t||(t=Promise))(function(o,a){function i(e){try{u(n.next(e))}catch(e){a(e)}}function c(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var r;e.done?o(e.value):(r=e.value,r instanceof t?r:new t(function(e){e(r)})).then(i,c)}u((n=n.apply(e,r||[])).next())})}function n(e,r){var t,n,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=c(0),i.throw=c(1),i.return=c(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(u){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(t=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,n=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=r.call(e,a)}catch(e){c=[6,e],n=0}finally{t=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,u])}}}"function"==typeof SuppressedError&&SuppressedError;var o=["geforce 320m","geforce 8600","geforce 8600m gt","geforce 8800 gs","geforce 8800 gt","geforce 9400","geforce 9400m g","geforce 9400m","geforce 9600m gt","geforce 9600m","geforce fx go5200","geforce gt 120","geforce gt 130","geforce gt 330m","geforce gtx 285","google swiftshader","intel g41","intel g45","intel gma 4500mhd","intel gma x3100","intel hd 3000","intel q45","legacy","mali-2","mali-3","mali-4","quadro fx 1500","quadro fx 4","quadro fx 5","radeon hd 2400","radeon hd 2600","radeon hd 4670","radeon hd 4850","radeon hd 4870","radeon hd 5670","radeon hd 5750","radeon hd 6290","radeon hd 6300","radeon hd 6310","radeon hd 6320","radeon hd 6490m","radeon hd 6630m","radeon hd 6750m","radeon hd 6770m","radeon hd 6970m","sgx 543","sgx543"];function a(e){return e=e.toLowerCase().replace(/.*angle ?\((.+)\)(?: on vulkan [0-9.]+)?$/i,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"").replace(/(?:vulkan|opengl) \d+\.\d+(?:\.\d+)?(?: \((.*)\))?/,"$1")}const i=34962;var c="undefined"==typeof window,u=function(){if(!c){var e=window.navigator,r=e.userAgent,t=e.platform,n=e.maxTouchPoints,o=/(iphone|ipod|ipad)/i.test(r),a="iPad"===t||"MacIntel"===t&&n>0&&!window.MSStream;return{isIpad:a,isMobile:/android/i.test(r)||o||a,isSafari12:/Version\/12.+Safari/.test(r),isFirefox:/Firefox/.test(r)}}}();function l(e,r,t){if(!t)return[r];var n,o=function(e){var r="\n precision highp float;\n attribute vec3 aPosition;\n varying float vvv;\n void main() {\n vvv = 0.31622776601683794;\n gl_Position = vec4(aPosition, 1.0);\n }\n ",t="\n precision highp float;\n varying float vvv;\n void main() {\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * vvv;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n gl_FragColor = enc;\n }\n ",n=e.createShader(35633),o=e.createShader(35632),a=e.createProgram();if(!(o&&n&&a))return;e.shaderSource(n,r),e.shaderSource(o,t),e.compileShader(n),e.compileShader(o),e.attachShader(a,n),e.attachShader(a,o),e.linkProgram(a),e.detachShader(a,n),e.detachShader(a,o),e.deleteShader(n),e.deleteShader(o),e.useProgram(a);var c=e.createBuffer();e.bindBuffer(i,c),e.bufferData(i,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);var u=e.getAttribLocation(a,"aPosition");e.vertexAttribPointer(u,3,5126,!1,0,0),e.enableVertexAttribArray(u),e.clearColor(1,1,1,1),e.clear(16384),e.viewport(0,0,1,1),e.drawArrays(4,0,3);var l=new Uint8Array(4);return e.readPixels(0,0,1,1,6408,5121,l),e.deleteProgram(a),e.deleteBuffer(c),l.join("")}(e),a="801621810",c="8016218135",l="80162181161",f=(null==u?void 0:u.isIpad)?[["a7",l,12],["a8",c,15],["a8x",c,15],["a9",c,15],["a9x",c,15],["a10",c,15],["a10x",c,15],["a12",a,15],["a12x",a,15],["a12z",a,15],["a14",a,15],["a15",a,15],["m1",a,15],["m2",a,15]]:[["a7",l,12],["a8",c,12],["a9",c,15],["a10",c,15],["a11",a,15],["a12",a,15],["a13",a,15],["a14",a,15],["a15",a,15],["a16",a,15],["a17",a,15]];return"80162181255"===o?n=f.filter(function(e){return e[2]>=14}):(n=f.filter(function(e){return e[1]===o})).length||(n=f),n.map(function(e){var r=e[0];return"apple ".concat(r," gpu")})}var f=function(e){function t(r){var t=this.constructor,n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t}(Error);var d=[],s=[];function h(e,r){if(e===r)return 0;var t=e;e.length>r.length&&(e=r,r=t);for(var n=e.length,o=r.length;n>0&&e.charCodeAt(~-n)===r.charCodeAt(~-o);)n--,o--;for(var a,i=0;i<n&&e.charCodeAt(i)===r.charCodeAt(i);)i++;if(o-=i,0===(n-=i))return o;for(var c,u,l=0,f=0,h=0;f<n;)s[f]=e.charCodeAt(i+f),d[f]=++f;for(;h<o;)for(a=r.charCodeAt(i+h),c=h++,l=h,f=0;f<n;f++)u=a===s[f]?c:c+1,c=d[f],l=d[f]=c>l?u>l?l+1:u:u>c?c+1:u;return l}function p(e){return null!=e}e.getGPUTier=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t(void 0,function(e,r,t){if(t||2===arguments.length)for(var n,o=0,a=r.length;o<a;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))}([],e,!0),void 0,function(e){function r(e){return t(this,void 0,void 0,function(){var r,t,o,a,c,u,l,d,p,v,m,y,x,P,S,E,C,_,L,j,M,k,B,I,O,R,T;return n(this,function(n){switch(n.label){case 0:if(!(r=A(e)))return[2];t="".concat(g?"m":"d","-").concat(r).concat(s?"-ipad":"",".json"),o=i[t]=null!==(T=i[t])&&void 0!==T?T:w(t),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,o];case 2:return a=n.sent(),[3,4];case 3:if((c=n.sent())instanceof f)throw c;return[2];case 4:if(u=function(e){var r,t=(e=e.replace(/\([^)]+\)/,"")).match(/\d+/)||e.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return null!==(r=null==t?void 0:t.join("").replace(/\W|amd/g,""))&&void 0!==r?r:""}(e),l=a.filter(function(e){return e[1]===u}),l.length||(l=a.filter(function(r){return r[0].includes(e)})),0===(d=l.length))return[2];for(p=e.split(/[.,()\[\]/\s]/g).sort().filter(function(e,r,t){return 0===r||e!==t[r-1]}).join(" "),v=d>1?l.map(function(e){return[e,h(p,e[2])]}).sort(function(e,r){return e[1]-r[1]})[0][0]:l[0],m=v[0],y=v[4],x=Number.MAX_VALUE,S=window.devicePixelRatio,E=b.width*S*b.height*S,C=0,_=y;C<_.length;C++)L=_[C],j=L[0],M=L[1],k=j*M,(B=Math.abs(E-k))<x&&(x=B,P=L);return P?(O=(I=P)[2],R=I[3],[2,[x,O,m,R]]):[2]}})})}var i,d,s,v,g,m,b,y,w,x,A,P,S,E,C,_,L,j,M,k,B,I,O,R,T,U=void 0===e?{}:e,D=U.mobileTiers,N=void 0===D?[0,15,30,60]:D,F=U.desktopTiers,G=void 0===F?[0,15,30,60]:F,K=U.override,W=void 0===K?{}:K,$=U.glContext,V=U.failIfMajorPerformanceCaveat,q=void 0!==V&&V,z=U.benchmarksURL,X=void 0===z?"https://unpkg.com/@grepp/detect-gpu@".concat("5.0.84","/dist/benchmarks"):z;return n(this,function(e){switch(e.label){case 0:if(i={},c)return[2,{tier:0,type:"SSR"}];if(d=W.isIpad,s=void 0===d?!!(null==u?void 0:u.isIpad):d,v=W.isMobile,g=void 0===v?!!(null==u?void 0:u.isMobile):v,m=W.screenSize,b=void 0===m?window.screen:m,y=W.loadBenchmarks,w=void 0===y?function(e){return t(void 0,void 0,void 0,function(){var r;return n(this,function(t){switch(t.label){case 0:return[4,fetch("".concat(X,"/").concat(e)).then(function(e){return e.json()})];case 1:if(r=t.sent(),parseInt(r.shift().split(".")[0],10)<4)throw new f("Detect GPU benchmark data is out of date. Please update to version 4x");return[2,r]}})})}:y,x=W.renderer,A=function(e){for(var r=0,t=g?["adreno","apple","mali-t","mali","nvidia","powervr","samsung"]:["intel","apple","amd","radeon","nvidia","geforce","adreno"];r<t.length;r++){var n=t[r];if(e.includes(n))return n}},P=function(e,r,t,n,o){return{device:o,fps:n,gpu:t,isMobile:g,tier:e,type:r}},E="",x)x=a(x),S=[x];else{if(C=$||function(e,r){void 0===r&&(r=!1);var t={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:r,powerPreference:"high-performance",stencil:!1};e&&delete t.powerPreference;var n=window.document.createElement("canvas"),o=n.getContext("webgl",t)||n.getContext("experimental-webgl",t);return null!=o?o:void 0}(null==u?void 0:u.isSafari12,q),!C)return[2,P(0,"WEBGL_UNSUPPORTED")];if(_=(null==u?void 0:u.isFirefox)?null:C.getExtension("WEBGL_debug_renderer_info"),!(x=_?C.getParameter(_.UNMASKED_RENDERER_WEBGL):C.getParameter(C.RENDERER)))return[2,P(1,"FALLBACK")];E=x,x=a(x),S=function(e,r,t){return"apple gpu"===r?l(e,r,t):[r]}(C,x,g)}return[4,Promise.all(S.map(r))];case 1:if(L=e.sent().filter(p).sort(function(e,r){var t=e[0],n=void 0===t?Number.MAX_VALUE:t,o=e[1],a=r[0],i=void 0===a?Number.MAX_VALUE:a,c=r[1];return n===i?o-c:n-i}),!L.length)return[2,(j=o.find(function(e){return x.includes(e)}))?P(0,"BLOCKLISTED",j):P(1,"FALLBACK","".concat(x," (").concat(E,")"))];if(M=L[0],k=M[1],B=M[2],I=M[3],-1===k)return[2,P(0,"BLOCKLISTED",B,k,I)];for(O=g?N:G,R=0,T=0;T<O.length;T++)k>=O[T]&&(R=T);return[2,P(R,"BENCHMARK",B,k,I)]}})})}});
|
2
2
|
//# sourceMappingURL=detect-gpu.umd.js.map
|
package/package.json
CHANGED