@grepp/detect-gpu 5.0.71 → 5.0.73
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 +1 -1
- package/dist/benchmarks/d-amd.json +3 -33
- package/dist/benchmarks/d-geforce.json +11 -6
- package/dist/benchmarks/d-intel.json +2 -7
- package/dist/benchmarks/d-nvidia.json +11 -6
- package/dist/benchmarks/d-radeon.json +3 -33
- package/dist/benchmarks/m-apple-ipad.json +3 -3
- package/dist/benchmarks/m-apple.json +7 -7
- package/dist/benchmarks/m-mali.json +20 -0
- package/dist/detect-gpu.esm.js +1 -1
- package/dist/detect-gpu.esm.js.map +1 -1
- package/dist/detect-gpu.umd.js +1 -1
- package/dist/detect-gpu.umd.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
@@ -52,7 +52,7 @@ getGPUTier({
|
|
52
52
|
/**
|
53
53
|
* URL of directory where benchmark data is hosted.
|
54
54
|
*
|
55
|
-
* @default https
|
55
|
+
* @default https://@grepp/unpkg.com/detect-gpu@{version}/dist/benchmarks
|
56
56
|
*/
|
57
57
|
benchmarksURL?: string;
|
58
58
|
/**
|
@@ -2870,11 +2870,6 @@
|
|
2870
2870
|
2560,
|
2871
2871
|
1600,
|
2872
2872
|
60
|
2873
|
-
],
|
2874
|
-
[
|
2875
|
-
3840,
|
2876
|
-
2160,
|
2877
|
-
80
|
2878
2873
|
]
|
2879
2874
|
]
|
2880
2875
|
],
|
@@ -7678,11 +7673,6 @@
|
|
7678
7673
|
"580 amd pro radeon",
|
7679
7674
|
0,
|
7680
7675
|
[
|
7681
|
-
[
|
7682
|
-
3840,
|
7683
|
-
2160,
|
7684
|
-
60
|
7685
|
-
],
|
7686
7676
|
[
|
7687
7677
|
5120,
|
7688
7678
|
2880,
|
@@ -11217,11 +11207,6 @@
|
|
11217
11207
|
2560,
|
11218
11208
|
1080,
|
11219
11209
|
60
|
11220
|
-
],
|
11221
|
-
[
|
11222
|
-
2560,
|
11223
|
-
1440,
|
11224
|
-
60
|
11225
11210
|
]
|
11226
11211
|
]
|
11227
11212
|
],
|
@@ -11247,7 +11232,7 @@
|
|
11247
11232
|
[
|
11248
11233
|
1920,
|
11249
11234
|
1080,
|
11250
|
-
|
11235
|
+
350
|
11251
11236
|
],
|
11252
11237
|
[
|
11253
11238
|
3840,
|
@@ -11490,11 +11475,6 @@
|
|
11490
11475
|
1920,
|
11491
11476
|
1080,
|
11492
11477
|
170
|
11493
|
-
],
|
11494
|
-
[
|
11495
|
-
3584,
|
11496
|
-
2240,
|
11497
|
-
37
|
11498
11478
|
]
|
11499
11479
|
]
|
11500
11480
|
],
|
@@ -12023,11 +12003,6 @@
|
|
12023
12003
|
"7900 amd radeon rx xt",
|
12024
12004
|
0,
|
12025
12005
|
[
|
12026
|
-
[
|
12027
|
-
2560,
|
12028
|
-
1440,
|
12029
|
-
1626
|
12030
|
-
],
|
12031
12006
|
[
|
12032
12007
|
3840,
|
12033
12008
|
2160,
|
@@ -12057,7 +12032,7 @@
|
|
12057
12032
|
[
|
12058
12033
|
1920,
|
12059
12034
|
1080,
|
12060
|
-
|
12035
|
+
60
|
12061
12036
|
]
|
12062
12037
|
]
|
12063
12038
|
],
|
@@ -12155,11 +12130,6 @@
|
|
12155
12130
|
1080,
|
12156
12131
|
60
|
12157
12132
|
],
|
12158
|
-
[
|
12159
|
-
2560,
|
12160
|
-
1440,
|
12161
|
-
60
|
12162
|
-
],
|
12163
12133
|
[
|
12164
12134
|
2560,
|
12165
12135
|
1600,
|
@@ -12168,7 +12138,7 @@
|
|
12168
12138
|
[
|
12169
12139
|
3440,
|
12170
12140
|
1440,
|
12171
|
-
|
12141
|
+
23
|
12172
12142
|
]
|
12173
12143
|
]
|
12174
12144
|
],
|
@@ -5101,6 +5101,11 @@
|
|
5101
5101
|
"geforce mx130 nvidia",
|
5102
5102
|
0,
|
5103
5103
|
[
|
5104
|
+
[
|
5105
|
+
1366,
|
5106
|
+
768,
|
5107
|
+
60
|
5108
|
+
],
|
5104
5109
|
[
|
5105
5110
|
1920,
|
5106
5111
|
1080,
|
@@ -5618,7 +5623,7 @@
|
|
5618
5623
|
[
|
5619
5624
|
1920,
|
5620
5625
|
1080,
|
5621
|
-
|
5626
|
+
621
|
5622
5627
|
]
|
5623
5628
|
]
|
5624
5629
|
],
|
@@ -5663,11 +5668,6 @@
|
|
5663
5668
|
1920,
|
5664
5669
|
1080,
|
5665
5670
|
693
|
5666
|
-
],
|
5667
|
-
[
|
5668
|
-
1920,
|
5669
|
-
1200,
|
5670
|
-
60
|
5671
5671
|
]
|
5672
5672
|
]
|
5673
5673
|
],
|
@@ -5940,6 +5940,11 @@
|
|
5940
5940
|
1920,
|
5941
5941
|
1080,
|
5942
5942
|
165
|
5943
|
+
],
|
5944
|
+
[
|
5945
|
+
2560,
|
5946
|
+
1600,
|
5947
|
+
165
|
5943
5948
|
]
|
5944
5949
|
]
|
5945
5950
|
],
|
@@ -1670,7 +1670,7 @@
|
|
1670
1670
|
[
|
1671
1671
|
3360,
|
1672
1672
|
2100,
|
1673
|
-
|
1673
|
+
55
|
1674
1674
|
],
|
1675
1675
|
[
|
1676
1676
|
3840,
|
@@ -2644,11 +2644,6 @@
|
|
2644
2644
|
"intel iris xe",
|
2645
2645
|
0,
|
2646
2646
|
[
|
2647
|
-
[
|
2648
|
-
1536,
|
2649
|
-
1024,
|
2650
|
-
56
|
2651
|
-
],
|
2652
2647
|
[
|
2653
2648
|
1920,
|
2654
2649
|
1080,
|
@@ -3488,7 +3483,7 @@
|
|
3488
3483
|
[
|
3489
3484
|
1920,
|
3490
3485
|
1080,
|
3491
|
-
|
3486
|
+
39
|
3492
3487
|
],
|
3493
3488
|
[
|
3494
3489
|
3840,
|
@@ -5327,6 +5327,11 @@
|
|
5327
5327
|
"geforce mx130 nvidia",
|
5328
5328
|
0,
|
5329
5329
|
[
|
5330
|
+
[
|
5331
|
+
1366,
|
5332
|
+
768,
|
5333
|
+
60
|
5334
|
+
],
|
5330
5335
|
[
|
5331
5336
|
1920,
|
5332
5337
|
1080,
|
@@ -5844,7 +5849,7 @@
|
|
5844
5849
|
[
|
5845
5850
|
1920,
|
5846
5851
|
1080,
|
5847
|
-
|
5852
|
+
621
|
5848
5853
|
]
|
5849
5854
|
]
|
5850
5855
|
],
|
@@ -5889,11 +5894,6 @@
|
|
5889
5894
|
1920,
|
5890
5895
|
1080,
|
5891
5896
|
693
|
5892
|
-
],
|
5893
|
-
[
|
5894
|
-
1920,
|
5895
|
-
1200,
|
5896
|
-
60
|
5897
5897
|
]
|
5898
5898
|
]
|
5899
5899
|
],
|
@@ -6166,6 +6166,11 @@
|
|
6166
6166
|
1920,
|
6167
6167
|
1080,
|
6168
6168
|
165
|
6169
|
+
],
|
6170
|
+
[
|
6171
|
+
2560,
|
6172
|
+
1600,
|
6173
|
+
165
|
6169
6174
|
]
|
6170
6175
|
]
|
6171
6176
|
],
|
@@ -921,11 +921,6 @@
|
|
921
921
|
2560,
|
922
922
|
1600,
|
923
923
|
60
|
924
|
-
],
|
925
|
-
[
|
926
|
-
3840,
|
927
|
-
2160,
|
928
|
-
80
|
929
924
|
]
|
930
925
|
]
|
931
926
|
],
|
@@ -5729,11 +5724,6 @@
|
|
5729
5724
|
"580 amd pro radeon",
|
5730
5725
|
0,
|
5731
5726
|
[
|
5732
|
-
[
|
5733
|
-
3840,
|
5734
|
-
2160,
|
5735
|
-
60
|
5736
|
-
],
|
5737
5727
|
[
|
5738
5728
|
5120,
|
5739
5729
|
2880,
|
@@ -9268,11 +9258,6 @@
|
|
9268
9258
|
2560,
|
9269
9259
|
1080,
|
9270
9260
|
60
|
9271
|
-
],
|
9272
|
-
[
|
9273
|
-
2560,
|
9274
|
-
1440,
|
9275
|
-
60
|
9276
9261
|
]
|
9277
9262
|
]
|
9278
9263
|
],
|
@@ -9298,7 +9283,7 @@
|
|
9298
9283
|
[
|
9299
9284
|
1920,
|
9300
9285
|
1080,
|
9301
|
-
|
9286
|
+
350
|
9302
9287
|
],
|
9303
9288
|
[
|
9304
9289
|
3840,
|
@@ -9541,11 +9526,6 @@
|
|
9541
9526
|
1920,
|
9542
9527
|
1080,
|
9543
9528
|
170
|
9544
|
-
],
|
9545
|
-
[
|
9546
|
-
3584,
|
9547
|
-
2240,
|
9548
|
-
37
|
9549
9529
|
]
|
9550
9530
|
]
|
9551
9531
|
],
|
@@ -10074,11 +10054,6 @@
|
|
10074
10054
|
"7900 amd radeon rx xt",
|
10075
10055
|
0,
|
10076
10056
|
[
|
10077
|
-
[
|
10078
|
-
2560,
|
10079
|
-
1440,
|
10080
|
-
1626
|
10081
|
-
],
|
10082
10057
|
[
|
10083
10058
|
3840,
|
10084
10059
|
2160,
|
@@ -10108,7 +10083,7 @@
|
|
10108
10083
|
[
|
10109
10084
|
1920,
|
10110
10085
|
1080,
|
10111
|
-
|
10086
|
+
60
|
10112
10087
|
]
|
10113
10088
|
]
|
10114
10089
|
],
|
@@ -10206,11 +10181,6 @@
|
|
10206
10181
|
1080,
|
10207
10182
|
60
|
10208
10183
|
],
|
10209
|
-
[
|
10210
|
-
2560,
|
10211
|
-
1440,
|
10212
|
-
60
|
10213
|
-
],
|
10214
10184
|
[
|
10215
10185
|
2560,
|
10216
10186
|
1600,
|
@@ -10219,7 +10189,7 @@
|
|
10219
10189
|
[
|
10220
10190
|
3440,
|
10221
10191
|
1440,
|
10222
|
-
|
10192
|
+
23
|
10223
10193
|
]
|
10224
10194
|
]
|
10225
10195
|
],
|
@@ -15,7 +15,7 @@
|
|
15
15
|
[
|
16
16
|
2160,
|
17
17
|
1620,
|
18
|
-
|
18
|
+
34,
|
19
19
|
"apple ipad (10.2-inch) (7th generation)"
|
20
20
|
]
|
21
21
|
]
|
@@ -265,7 +265,7 @@
|
|
265
265
|
[
|
266
266
|
2360,
|
267
267
|
1640,
|
268
|
-
|
268
|
+
120,
|
269
269
|
"apple ipad air (5th generation)"
|
270
270
|
],
|
271
271
|
[
|
@@ -297,7 +297,7 @@
|
|
297
297
|
[
|
298
298
|
2388,
|
299
299
|
1668,
|
300
|
-
|
300
|
+
60,
|
301
301
|
"apple ipad pro 11 inch (4th gen)"
|
302
302
|
],
|
303
303
|
[
|
@@ -93,13 +93,13 @@
|
|
93
93
|
[
|
94
94
|
1792,
|
95
95
|
828,
|
96
|
-
|
96
|
+
66,
|
97
97
|
"apple iphone 11"
|
98
98
|
],
|
99
99
|
[
|
100
100
|
2436,
|
101
101
|
1125,
|
102
|
-
|
102
|
+
31,
|
103
103
|
"apple iphone 11 pro"
|
104
104
|
],
|
105
105
|
[
|
@@ -158,12 +158,12 @@
|
|
158
158
|
2532,
|
159
159
|
1170,
|
160
160
|
60,
|
161
|
-
"apple iphone
|
161
|
+
"apple iphone 14"
|
162
162
|
],
|
163
163
|
[
|
164
164
|
2778,
|
165
165
|
1284,
|
166
|
-
|
166
|
+
60,
|
167
167
|
"apple iphone 13 pro max"
|
168
168
|
]
|
169
169
|
]
|
@@ -184,7 +184,7 @@
|
|
184
184
|
2778,
|
185
185
|
1284,
|
186
186
|
60,
|
187
|
-
"apple iphone
|
187
|
+
"apple iphone 15 plus"
|
188
188
|
]
|
189
189
|
]
|
190
190
|
],
|
@@ -203,7 +203,7 @@
|
|
203
203
|
[
|
204
204
|
2778,
|
205
205
|
1284,
|
206
|
-
|
206
|
+
122,
|
207
207
|
"apple iphone 15 pro max"
|
208
208
|
]
|
209
209
|
]
|
@@ -218,7 +218,7 @@
|
|
218
218
|
2532,
|
219
219
|
1170,
|
220
220
|
60,
|
221
|
-
"apple iphone 16 (iphone17,
|
221
|
+
"apple iphone 16 (iphone17,3)"
|
222
222
|
]
|
223
223
|
]
|
224
224
|
],
|
@@ -218,6 +218,26 @@
|
|
218
218
|
]
|
219
219
|
]
|
220
220
|
],
|
221
|
+
[
|
222
|
+
"arm mali-g68",
|
223
|
+
"68",
|
224
|
+
"arm mali-g68",
|
225
|
+
0,
|
226
|
+
[
|
227
|
+
[
|
228
|
+
2207,
|
229
|
+
1080,
|
230
|
+
57,
|
231
|
+
"samsung galaxy m33"
|
232
|
+
],
|
233
|
+
[
|
234
|
+
2344,
|
235
|
+
1080,
|
236
|
+
34,
|
237
|
+
"samsung galaxy a14 5g"
|
238
|
+
]
|
239
|
+
]
|
240
|
+
],
|
221
241
|
[
|
222
242
|
"arm mali-g68 mc4",
|
223
243
|
"68",
|
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/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.73/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
|