detect-gpu
Advanced tools
Comparing version 5.0.37 to 5.0.38
[ | ||
"5.0.37", | ||
"5", | ||
[ | ||
@@ -107,2 +107,7 @@ "qualcomm adreno 540", | ||
1920, | ||
1080, | ||
60 | ||
], | ||
[ | ||
1920, | ||
1280, | ||
@@ -114,2 +119,15 @@ 28 | ||
[ | ||
"qualcomm adreno 7c+ gen 3", | ||
"7", | ||
"3 7c+ adreno gen qualcomm", | ||
0, | ||
[ | ||
[ | ||
1920, | ||
1080, | ||
44 | ||
] | ||
] | ||
], | ||
[ | ||
"qualcomm adreno 8cx gen 3", | ||
@@ -124,5 +142,23 @@ "8", | ||
22 | ||
], | ||
[ | ||
1920, | ||
1200, | ||
46 | ||
] | ||
] | ||
], | ||
[ | ||
"qualcomm adreno 8cx gen 4", | ||
"8", | ||
"4 8cx adreno gen qualcomm", | ||
0, | ||
[ | ||
[ | ||
2880, | ||
1800, | ||
60 | ||
] | ||
] | ||
] | ||
] |
[ | ||
"5.0.37", | ||
"5", | ||
[ | ||
@@ -51,3 +51,3 @@ "apple a14", | ||
1964, | ||
342 | ||
378 | ||
] | ||
@@ -132,2 +132,41 @@ ] | ||
[ | ||
"apple m3", | ||
"3", | ||
"apple m3", | ||
0, | ||
[ | ||
[ | ||
4480, | ||
2520, | ||
60 | ||
] | ||
] | ||
], | ||
[ | ||
"apple m3 max", | ||
"3", | ||
"apple m3 max", | ||
0, | ||
[ | ||
[ | ||
3456, | ||
2234, | ||
120 | ||
] | ||
] | ||
], | ||
[ | ||
"apple m3 pro", | ||
"3", | ||
"apple m3 pro", | ||
0, | ||
[ | ||
[ | ||
3024, | ||
1964, | ||
120 | ||
] | ||
] | ||
], | ||
[ | ||
"apple paravirtual device", | ||
@@ -134,0 +173,0 @@ "", |
[ | ||
"5.0.37", | ||
"5", | ||
[ | ||
@@ -12,3 +12,3 @@ "intel", | ||
1920, | ||
75 | ||
104 | ||
], | ||
@@ -49,3 +49,3 @@ [ | ||
1800, | ||
92 | ||
191 | ||
] | ||
@@ -99,3 +99,3 @@ ] | ||
1080, | ||
60 | ||
75 | ||
] | ||
@@ -124,5 +124,5 @@ ] | ||
[ | ||
3840, | ||
2160, | ||
330 | ||
1920, | ||
1080, | ||
58 | ||
] | ||
@@ -138,5 +138,5 @@ ] | ||
[ | ||
3840, | ||
2160, | ||
271 | ||
2560, | ||
1600, | ||
257 | ||
] | ||
@@ -178,9 +178,4 @@ ] | ||
[ | ||
2560, | ||
1440, | ||
714 | ||
], | ||
[ | ||
2560, | ||
1600, | ||
1920, | ||
1080, | ||
60 | ||
@@ -238,3 +233,3 @@ ] | ||
2160, | ||
245 | ||
59 | ||
] | ||
@@ -291,3 +286,3 @@ ] | ||
1080, | ||
52 | ||
68 | ||
] | ||
@@ -297,2 +292,15 @@ ] | ||
[ | ||
"intel coffeelake-u gt3e [iris plus graphics 655]", | ||
"3", | ||
" 655 coffeelake-u graphics gt3e intel iris plus", | ||
0, | ||
[ | ||
[ | ||
2560, | ||
1440, | ||
26 | ||
] | ||
] | ||
], | ||
[ | ||
"intel cometlake uhd graphics 630", | ||
@@ -1293,3 +1301,3 @@ "630", | ||
1080, | ||
19 | ||
8 | ||
], | ||
@@ -1330,3 +1338,3 @@ [ | ||
768, | ||
38 | ||
45 | ||
], | ||
@@ -1390,2 +1398,7 @@ [ | ||
[ | ||
1024, | ||
768, | ||
75 | ||
], | ||
[ | ||
1366, | ||
@@ -1530,3 +1543,3 @@ 768, | ||
1080, | ||
21 | ||
17 | ||
], | ||
@@ -1542,7 +1555,2 @@ [ | ||
13 | ||
], | ||
[ | ||
2880, | ||
1800, | ||
13 | ||
] | ||
@@ -1612,7 +1620,2 @@ ] | ||
21 | ||
], | ||
[ | ||
2560, | ||
1440, | ||
22 | ||
] | ||
@@ -1745,7 +1748,2 @@ ] | ||
[ | ||
1440, | ||
900, | ||
60 | ||
], | ||
[ | ||
1920, | ||
@@ -2090,7 +2088,2 @@ 1080, | ||
19 | ||
], | ||
[ | ||
3360, | ||
2100, | ||
13 | ||
] | ||
@@ -2379,3 +2372,3 @@ ] | ||
1800, | ||
19 | ||
21 | ||
] | ||
@@ -3080,3 +3073,3 @@ ] | ||
1080, | ||
19 | ||
37 | ||
] | ||
@@ -3211,3 +3204,3 @@ ] | ||
1080, | ||
68 | ||
40 | ||
], | ||
@@ -3263,3 +3256,3 @@ [ | ||
1080, | ||
55 | ||
69 | ||
] | ||
@@ -3332,2 +3325,7 @@ ] | ||
[ | ||
1728, | ||
1079, | ||
31 | ||
], | ||
[ | ||
1920, | ||
@@ -3334,0 +3332,0 @@ 1080, |
[ | ||
"5.0.37", | ||
"5", | ||
[ | ||
@@ -1150,2 +1150,8 @@ "adreno 506", | ||
[ | ||
1798, | ||
1080, | ||
17, | ||
"sharp aquos serie mini shv33" | ||
], | ||
[ | ||
1920, | ||
@@ -1917,4 +1923,4 @@ 1080, | ||
[ | ||
1473, | ||
720, | ||
1557, | ||
678, | ||
33, | ||
@@ -2018,3 +2024,3 @@ "motorola moto g30" | ||
1080, | ||
34, | ||
35, | ||
"xiaomi mi 9t" | ||
@@ -2029,2 +2035,8 @@ ], | ||
[ | ||
2268, | ||
1080, | ||
36, | ||
"xiaomi mi note 10 lite" | ||
], | ||
[ | ||
2274, | ||
@@ -2086,3 +2098,3 @@ 1080, | ||
1440, | ||
43, | ||
49, | ||
"samsung galaxy s9 (sm-g960u)" | ||
@@ -2141,2 +2153,8 @@ ], | ||
[ | ||
2292, | ||
1039, | ||
60, | ||
"realme x3 superzoom (rmx2086)" | ||
], | ||
[ | ||
2210, | ||
@@ -2268,2 +2286,8 @@ 1080, | ||
[ | ||
2270, | ||
1080, | ||
60, | ||
"xiaomi poco f2 pro" | ||
], | ||
[ | ||
2274, | ||
@@ -2275,11 +2299,5 @@ 1080, | ||
[ | ||
2400, | ||
1080, | ||
60, | ||
"xiaomi poco f2 pro" | ||
], | ||
[ | ||
2560, | ||
1510, | ||
60, | ||
1600, | ||
80, | ||
"samsung galaxy tab s7" | ||
@@ -2362,8 +2380,14 @@ ], | ||
1080, | ||
116, | ||
120, | ||
"samsung galaxy s22 5g (sm-s901u)" | ||
], | ||
[ | ||
2316, | ||
1032, | ||
2183, | ||
1080, | ||
61, | ||
"xiaomi 12" | ||
], | ||
[ | ||
2184, | ||
1080, | ||
60, | ||
@@ -2386,8 +2410,28 @@ "oneplus 10 pro 5g" | ||
2800, | ||
1720, | ||
79, | ||
1650, | ||
104, | ||
"samsung galaxy tab s8+ (sm-x800)" | ||
] | ||
] | ||
], | ||
[ | ||
"qualcomm adreno 740", | ||
"740", | ||
"740 adreno qualcomm", | ||
0, | ||
[ | ||
[ | ||
2266, | ||
1038, | ||
120, | ||
"samsung galaxy s23+" | ||
], | ||
[ | ||
2296, | ||
1080, | ||
121, | ||
"xiaomi 13" | ||
] | ||
] | ||
] | ||
] |
[ | ||
"5.0.37", | ||
"5", | ||
[ | ||
@@ -18,3 +18,3 @@ "apple a10 gpu", | ||
1620, | ||
37, | ||
36, | ||
"apple ipad (10.2-inch) (7th generation)" | ||
@@ -39,3 +39,3 @@ ] | ||
1668, | ||
43, | ||
1596, | ||
"apple ipad pro (10.5-inch)" | ||
@@ -46,3 +46,3 @@ ], | ||
2048, | ||
48, | ||
44, | ||
"apple ipad pro (12.9-inch, 2nd gen)" | ||
@@ -67,3 +67,3 @@ ] | ||
1620, | ||
55, | ||
58, | ||
"apple ipad 8th gen (wifi+cellular)" | ||
@@ -74,3 +74,3 @@ ], | ||
1668, | ||
59, | ||
58, | ||
"apple ipad air (2019)" | ||
@@ -109,4 +109,4 @@ ] | ||
1668, | ||
115, | ||
"apple ipad pro (11-inch) (2nd generation)" | ||
107, | ||
"apple ipad pro (11-inch) (2rd generation)" | ||
], | ||
@@ -145,3 +145,3 @@ [ | ||
60, | ||
"apple ipad (10th generation)" | ||
"apple ipad air (4th generation)" | ||
], | ||
@@ -291,6 +291,12 @@ [ | ||
[ | ||
2730, | ||
2048, | ||
117, | ||
"apple ipad pro 12.9-inch (6th generation)" | ||
], | ||
[ | ||
2732, | ||
2048, | ||
119, | ||
"apple ipad pro 12.9-inch (6th generation)" | ||
120, | ||
"apple ipad pro 12.9 inch (6th gen)" | ||
] | ||
@@ -297,0 +303,0 @@ ] |
[ | ||
"5.0.37", | ||
"5", | ||
[ | ||
@@ -10,2 +10,8 @@ "apple a10 gpu", | ||
[ | ||
1136, | ||
640, | ||
59, | ||
"apple ipod touch (7th gen)" | ||
], | ||
[ | ||
1334, | ||
@@ -59,3 +65,3 @@ 750, | ||
828, | ||
60, | ||
65, | ||
"apple iphone xr" | ||
@@ -67,3 +73,3 @@ ], | ||
60, | ||
"apple iphone xs max" | ||
"apple iphone xs" | ||
], | ||
@@ -87,3 +93,3 @@ [ | ||
750, | ||
75, | ||
60, | ||
"apple iphone se (2nd gen)" | ||
@@ -94,3 +100,3 @@ ], | ||
828, | ||
60, | ||
66, | ||
"apple iphone 11" | ||
@@ -107,3 +113,3 @@ ], | ||
1242, | ||
60, | ||
70, | ||
"apple iphone 11 pro max" | ||
@@ -148,3 +154,3 @@ ] | ||
750, | ||
118, | ||
60, | ||
"apple iphone se (2022)" | ||
@@ -162,3 +168,3 @@ ], | ||
60, | ||
"apple iphone 13" | ||
"apple iphone 14" | ||
], | ||
@@ -194,2 +200,22 @@ [ | ||
[ | ||
"apple a17 pro gpu", | ||
"17", | ||
"a17 apple gpu pro", | ||
0, | ||
[ | ||
[ | ||
2532, | ||
1170, | ||
60, | ||
"apple iphone 15 pro" | ||
], | ||
[ | ||
2778, | ||
1284, | ||
122, | ||
"apple iphone 15 pro max" | ||
] | ||
] | ||
], | ||
[ | ||
"apple a7 gpu", | ||
@@ -196,0 +222,0 @@ "7", |
[ | ||
"5.0.37", | ||
"5", | ||
[ | ||
@@ -4,0 +4,0 @@ "intel intel hd graphics for atom x5", |
[ | ||
"5.0.37", | ||
"5", | ||
[ | ||
@@ -4,0 +4,0 @@ "arm mali-t604 mp4", |
[ | ||
"5.0.37", | ||
"5", | ||
[ | ||
@@ -144,3 +144,3 @@ "arm mali-g31", | ||
1080, | ||
34, | ||
35, | ||
"samsung galaxy a22 5g" | ||
@@ -185,2 +185,22 @@ ], | ||
[ | ||
"arm mali-g68 mc4", | ||
"68", | ||
"arm mali-g68 mc4", | ||
0, | ||
[ | ||
[ | ||
2153, | ||
1080, | ||
56, | ||
"oppo reno6 5g" | ||
], | ||
[ | ||
2944, | ||
1712, | ||
31, | ||
"lenovo tab p12" | ||
] | ||
] | ||
], | ||
[ | ||
"arm mali-g71", | ||
@@ -356,2 +376,16 @@ "71", | ||
[ | ||
"arm mali-g720-immortalis mc12", | ||
"720", | ||
"arm mali-g720-immortalis mc12", | ||
0, | ||
[ | ||
[ | ||
2680, | ||
1260, | ||
120, | ||
"vivo x100" | ||
] | ||
] | ||
], | ||
[ | ||
"arm mali-g76", | ||
@@ -393,2 +427,8 @@ "76", | ||
[ | ||
2159, | ||
1080, | ||
47, | ||
"samsung galaxy a51 5g" | ||
], | ||
[ | ||
2176, | ||
@@ -412,8 +452,2 @@ 1080, | ||
[ | ||
2312, | ||
1080, | ||
27, | ||
"samsung galaxy a51 5g" | ||
], | ||
[ | ||
2328, | ||
@@ -446,3 +480,3 @@ 1128, | ||
59, | ||
"samsung galaxy note 10+ 5g (mali-g76, sm-n976x)" | ||
"samsung galaxy note 10+ (mali-g76, sm-n975x)" | ||
], | ||
@@ -478,5 +512,11 @@ [ | ||
[ | ||
2168, | ||
1080, | ||
93, | ||
"samsung galaxy s20 fe (sm-g780f)" | ||
], | ||
[ | ||
2173, | ||
1080, | ||
57, | ||
58, | ||
"samsung galaxy note 20 (sm-n980f)" | ||
@@ -493,3 +533,3 @@ ], | ||
1080, | ||
67, | ||
95, | ||
"samsung galaxy s20 ultra 5g (sm-g988b)" | ||
@@ -504,8 +544,2 @@ ], | ||
[ | ||
2256, | ||
1080, | ||
110, | ||
"samsung galaxy s20 fe (sm-g780f)" | ||
], | ||
[ | ||
2304, | ||
@@ -512,0 +546,0 @@ 1080, |
[ | ||
"5.0.37", | ||
"5", | ||
[ | ||
@@ -4,0 +4,0 @@ "nvidia tegra", |
[ | ||
"5.0.37", | ||
"5", | ||
[ | ||
@@ -395,2 +395,8 @@ "powervr rogue g6110", | ||
1920, | ||
1024, | ||
33, | ||
"renesas salvator-x-r8a7795" | ||
], | ||
[ | ||
1920, | ||
1032, | ||
@@ -397,0 +403,0 @@ 24, |
[ | ||
"5.0.37", | ||
"5", | ||
[ | ||
@@ -4,0 +4,0 @@ "samsung xclipse 920", |
@@ -1,2 +0,2 @@ | ||
function e(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{d(r.next(e))}catch(e){a(e)}}function c(e){try{d(r.throw(e))}catch(e){a(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}d((r=r.apply(e,t||[])).next())}))}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 n(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 r="undefined"==typeof window,o=(()=>{if(r)return;const{userAgent:e,platform:t,maxTouchPoints:n}=window.navigator,o=/(iphone|ipod|ipad)/i.test(e),a="iPad"===t||"MacIntel"===t&&n>0&&!window.MSStream;return{isIpad:a,isMobile:/android/i.test(e)||o||a,isSafari12:/Version\/12.+Safari/.test(e)}})();function a(e,t,n){if(!n)return[t];const r=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 ",n="\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 ",r=e.createShader(35633),o=e.createShader(35632),a=e.createProgram();if(!(o&&r&&a))return;e.shaderSource(r,t),e.shaderSource(o,n),e.compileShader(r),e.compileShader(o),e.attachShader(a,r),e.attachShader(a,o),e.linkProgram(a),e.detachShader(a,r),e.detachShader(a,o),e.deleteShader(r),e.deleteShader(o),e.useProgram(a);const i=e.createBuffer();e.bindBuffer(34962,i),e.bufferData(34962,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);const c=e.getAttribLocation(a,"aPosition");e.vertexAttribPointer(c,3,5126,!1,0,0),e.enableVertexAttribArray(c),e.clearColor(1,1,1,1),e.clear(16384),e.viewport(0,0,1,1),e.drawArrays(4,0,3);const d=new Uint8Array(4);return e.readPixels(0,0,1,1,6408,5121,d),e.deleteProgram(a),e.deleteBuffer(i),d.join("")}(e),a="801621810",i="8016218135",c="80162181161",d=(null==o?void 0:o.isIpad)?[["a7",c,12],["a8",i,15],["a8x",i,15],["a9",i,15],["a9x",i,15],["a10",i,15],["a10x",i,15],["a12",a,15],["a12x",a,15],["a12z",a,15],["a14",a,15],["m1",a,15]]:[["a7",c,12],["a8",i,12],["a9",i,15],["a10",i,15],["a11",a,15],["a12",a,15],["a13",a,15],["a14",a,15]];let l;"80162181255"===r?l=d.filter((([,,e])=>e>=14)):(l=d.filter((([,e])=>e===r)),l.length||(l=d));return l.map((([e])=>`apple ${e} gpu`))}class i extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const c=[],d=[];function l(e,t){if(e===t)return 0;const n=e;e.length>t.length&&(e=t,t=n);let r=e.length,o=t.length;for(;r>0&&e.charCodeAt(~-r)===t.charCodeAt(~-o);)r--,o--;let a,i=0;for(;i<r&&e.charCodeAt(i)===t.charCodeAt(i);)i++;if(r-=i,o-=i,0===r)return o;let l,s,f=0,u=0,h=0;for(;u<r;)d[u]=e.charCodeAt(i+u),c[u]=++u;for(;h<o;)for(a=t.charCodeAt(i+h),l=h++,f=h,u=0;u<r;u++)s=a===d[u]?l:l+1,l=c[u],f=c[u]=l>f?s>f?f+1:s:s>l?l+1:s;return f}function s(e){return null!=e}const f=({mobileTiers:c=[0,15,30,60],desktopTiers:d=[0,15,30,60],override:f={},glContext:u,failIfMajorPerformanceCaveat:h=!1,benchmarksURL:g="https://unpkg.com/detect-gpu@5.0.37/dist/benchmarks"}={})=>e(void 0,void 0,void 0,(function*(){const p={};if(r)return{tier:0,type:"SSR"};const{isIpad:m=!!(null==o?void 0:o.isIpad),isMobile:v=!!(null==o?void 0:o.isMobile),screenSize:w=window.screen,loadBenchmarks:x=(t=>e(void 0,void 0,void 0,(function*(){const e=yield fetch(`${g}/${t}`).then((e=>e.json()));if(parseInt(e.shift().split(".")[0],10)<4)throw new i("Detect GPU benchmark data is out of date. Please update to version 4x");return e})))}=f;let{renderer:A}=f;const P=(e,t,n,r,o)=>({device:o,fps:r,gpu:n,isMobile:v,tier:e,type:t});let b,S="";if(A)A=n(A),b=[A];else{const e=u||function(e,t=!1){const n={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:t,powerPreference:"high-performance",stencil:!1};e&&delete n.powerPreference;const r=window.document.createElement("canvas"),o=r.getContext("webgl",n)||r.getContext("experimental-webgl",n);return null!=o?o:void 0}(null==o?void 0:o.isSafari12,h);if(!e)return P(0,"WEBGL_UNSUPPORTED");const t=e.getExtension("WEBGL_debug_renderer_info");if(t&&(A=e.getParameter(t.UNMASKED_RENDERER_WEBGL)),!A)return P(1,"FALLBACK");S=A,A=n(A),b=function(e,t,n){return"apple gpu"===t?a(e,t,n):[t]}(e,A,v)}const y=(yield Promise.all(b.map((function(t){var n;return e(this,void 0,void 0,(function*(){const e=(e=>{const t=v?["adreno","apple","mali-t","mali","nvidia","powervr","samsung"]:["intel","apple","amd","radeon","nvidia","geforce"];for(const n of t)if(e.includes(n))return n})(t);if(!e)return;const r=`${v?"m":"d"}-${e}${m?"-ipad":""}.json`,o=p[r]=null!==(n=p[r])&&void 0!==n?n:x(r);let a;try{a=yield o}catch(e){if(e instanceof i)throw e;return}const c=function(e){var t;const n=(e=e.replace(/\([^)]+\)/,"")).match(/\d+/)||e.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return null!==(t=null==n?void 0:n.join("").replace(/\W|amd/g,""))&&void 0!==t?t:""}(t);let d=a.filter((([,e])=>e===c));d.length||(d=a.filter((([e])=>e.includes(t))));const s=d.length;if(0===s)return;const f=t.split(/[.,()\[\]/\s]/g).sort().filter(((e,t,n)=>0===t||e!==n[t-1])).join(" ");let u,[h,,,,g]=s>1?d.map((e=>[e,l(f,e[2])])).sort((([,e],[,t])=>e-t))[0][0]:d[0],A=Number.MAX_VALUE;const{devicePixelRatio:P}=window,b=w.width*P*w.height*P;for(const e of g){const[t,n]=e,r=t*n,o=Math.abs(b-r);o<A&&(A=o,u=e)}if(!u)return;const[,,S,y]=u;return[A,S,h,y]}))})))).filter(s).sort((([e=Number.MAX_VALUE,t],[n=Number.MAX_VALUE,r])=>e===n?t-r:e-n));if(!y.length){const e=t.find((e=>A.includes(e)));return e?P(0,"BLOCKLISTED",e):P(1,"FALLBACK",`${A} (${S})`)}const[,C,E,L]=y[0];if(-1===C)return P(0,"BLOCKLISTED",E,C,L);const M=v?c:d;let $=0;for(let e=0;e<M.length;e++)C>=M[e]&&($=e);return P($,"BENCHMARK",E,C,L)}));export{f as getGPUTier}; | ||
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="undefined"==typeof window,o=(()=>{if(n)return;const{userAgent:e,platform:t,maxTouchPoints:r}=window.navigator,o=/(iphone|ipod|ipad)/i.test(e),a="iPad"===t||"MacIntel"===t&&r>0&&!window.MSStream;return{isIpad:a,isMobile:/android/i.test(e)||o||a,isSafari12:/Version\/12.+Safari/.test(e),isFirefox:/Firefox/.test(e)}})();function a(e,t,r){if(!r)return[t];const n=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 ",n=e.createShader(35633),o=e.createShader(35632),a=e.createProgram();if(!(o&&n&&a))return;e.shaderSource(n,t),e.shaderSource(o,r),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);const i=e.createBuffer();e.bindBuffer(34962,i),e.bufferData(34962,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);const c=e.getAttribLocation(a,"aPosition");e.vertexAttribPointer(c,3,5126,!1,0,0),e.enableVertexAttribArray(c),e.clearColor(1,1,1,1),e.clear(16384),e.viewport(0,0,1,1),e.drawArrays(4,0,3);const d=new Uint8Array(4);return e.readPixels(0,0,1,1,6408,5121,d),e.deleteProgram(a),e.deleteBuffer(i),d.join("")}(e),a="801621810",i="8016218135",c="80162181161",d=(null==o?void 0:o.isIpad)?[["a7",c,12],["a8",i,15],["a8x",i,15],["a9",i,15],["a9x",i,15],["a10",i,15],["a10x",i,15],["a12",a,15],["a12x",a,15],["a12z",a,15],["a14",a,15],["m1",a,15]]:[["a7",c,12],["a8",i,12],["a9",i,15],["a10",i,15],["a11",a,15],["a12",a,15],["a13",a,15],["a14",a,15],["a15",a,15],["a16",a,15],["a17",a,15]];let l;"80162181255"===n?l=d.filter((([,,e])=>e>=14)):(l=d.filter((([,e])=>e===n)),l.length||(l=d));return l.map((([e])=>`apple ${e} gpu`))}class i extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const c=[],d=[];function l(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 l,s,f=0,u=0,g=0;for(;u<n;)d[u]=e.charCodeAt(i+u),c[u]=++u;for(;g<o;)for(a=t.charCodeAt(i+g),l=g++,f=g,u=0;u<n;u++)s=a===d[u]?l:l+1,l=c[u],f=c[u]=l>f?s>f?f+1:s:s>l?l+1:s;return f}function s(e){return null!=e}const f=({mobileTiers:c=[0,15,30,60],desktopTiers:d=[0,15,30,60],override:f={},glContext:u,failIfMajorPerformanceCaveat:g=!1,benchmarksURL:h="https://unpkg.com/detect-gpu@5.0.38/dist/benchmarks"}={})=>e(void 0,void 0,void 0,(function*(){const p={};if(n)return{tier:0,type:"SSR"};const{isIpad:m=!!(null==o?void 0:o.isIpad),isMobile:v=!!(null==o?void 0:o.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 i("Detect GPU benchmark data is out of date. Please update to version 4x");return e})))}=f;let{renderer:A}=f;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==o?void 0:o.isSafari12,g);if(!e)return P(0,"WEBGL_UNSUPPORTED");const t=(null==o?void 0:o.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?a(e,t,r):[t]}(e,A,v)}const E=(yield Promise.all(S.map((function(t){var r;return e(this,void 0,void 0,(function*(){const e=(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(!e)return;const n=`${v?"m":"d"}-${e}${m?"-ipad":""}.json`,o=p[n]=null!==(r=p[n])&&void 0!==r?r:x(n);let a;try{a=yield o}catch(e){if(e instanceof i)throw e;return}const c=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===c));d.length||(d=a.filter((([e])=>e.includes(t))));const s=d.length;if(0===s)return;const f=t.split(/[.,()\[\]/\s]/g).sort().filter(((e,t,r)=>0===t||e!==r[t-1])).join(" ");let u,[g,,,,h]=s>1?d.map((e=>[e,l(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(s).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?c:d;let $=0;for(let e=0;e<M.length;e++)y>=M[e]&&($=e);return P($,"BENCHMARK",C,y,L)}));export{f as getGPUTier}; | ||
//# sourceMappingURL=detect-gpu.esm.js.map |
@@ -1,2 +0,2 @@ | ||
!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,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(e,n)};function n(e,r,n,t){return new(n||(n=Promise))((function(o,a){function i(e){try{u(t.next(e))}catch(e){a(e)}}function c(e){try{u(t.throw(e))}catch(e){a(e)}}function u(e){var r;e.done?o(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(i,c)}u((t=t.apply(e,r||[])).next())}))}function t(e,r){var n,t,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i;)try{if(n=1,t&&(o=2&a[0]?t.return:a[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,a[1])).done)return o;switch(t=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,t=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=r.call(e,i)}catch(e){a=[6,e],t=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}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,n=e.platform,t=e.maxTouchPoints,o=/(iphone|ipod|ipad)/i.test(r),a="iPad"===n||"MacIntel"===n&&t>0&&!window.MSStream;return{isIpad:a,isMobile:/android/i.test(r)||o||a,isSafari12:/Version\/12.+Safari/.test(r)}}}();function l(e,r,n){if(!n)return[r];var t,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 ",n="\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 ",t=e.createShader(35633),o=e.createShader(35632),a=e.createProgram();if(!(o&&t&&a))return;e.shaderSource(t,r),e.shaderSource(o,n),e.compileShader(t),e.compileShader(o),e.attachShader(a,t),e.attachShader(a,o),e.linkProgram(a),e.detachShader(a,t),e.detachShader(a,o),e.deleteShader(t),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],["m1",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]];return"80162181255"===o?t=f.filter((function(e){return e[2]>=14})):(t=f.filter((function(e){return e[1]===o}))).length||(t=f),t.map((function(e){var r=e[0];return"apple ".concat(r," gpu")}))}var f=function(e){function n(r){var n=this.constructor,t=e.call(this,r)||this;return Object.setPrototypeOf(t,n.prototype),t}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}(n,e),n}(Error);var d=[],s=[];function h(e,r){if(e===r)return 0;var n=e;e.length>r.length&&(e=r,r=n);for(var t=e.length,o=r.length;t>0&&e.charCodeAt(~-t)===r.charCodeAt(~-o);)t--,o--;for(var a,i=0;i<t&&e.charCodeAt(i)===r.charCodeAt(i);)i++;if(o-=i,0===(t-=i))return o;for(var c,u,l=0,f=0,h=0;f<t;)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<t;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 v(e){return null!=e}e.getGPUTier=function(e){var r=void 0===e?{}:e,i=r.mobileTiers,d=void 0===i?[0,15,30,60]:i,s=r.desktopTiers,p=void 0===s?[0,15,30,60]:s,g=r.override,m=void 0===g?{}:g,b=r.glContext,w=r.failIfMajorPerformanceCaveat,y=void 0!==w&&w,x=r.benchmarksURL,P=void 0===x?"https://unpkg.com/detect-gpu@".concat("5.0.37","/dist/benchmarks"):x;return n(void 0,void 0,void 0,(function(){function e(e){var o;return n(this,void 0,void 0,(function(){var n,a,i,c,u,l,d,v,p,g,m,b,y,x,P,S,C,L,M,j,k,B,O,T,U,I;return t(this,(function(t){switch(t.label){case 0:if(!(n=E(e)))return[2];a="".concat(w?"m":"d","-").concat(n).concat(s?"-ipad":"",".json"),i=r[a]=null!==(o=r[a])&&void 0!==o?o:_(a),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,i];case 2:return c=t.sent(),[3,4];case 3:if((u=t.sent())instanceof f)throw u;return[2];case 4:if(l=function(e){var r,n=(e=e.replace(/\([^)]+\)/,"")).match(/\d+/)||e.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return null!==(r=null==n?void 0:n.join("").replace(/\W|amd/g,""))&&void 0!==r?r:""}(e),(d=c.filter((function(e){return e[1]===l}))).length||(d=c.filter((function(r){return r[0].includes(e)}))),0===(v=d.length))return[2];for(p=e.split(/[.,()\[\]/\s]/g).sort().filter((function(e,r,n){return 0===r||e!==n[r-1]})).join(" "),g=v>1?d.map((function(e){return[e,h(p,e[2])]})).sort((function(e,r){return e[1]-r[1]}))[0][0]:d[0],m=g[0],b=g[4],y=Number.MAX_VALUE,P=window.devicePixelRatio,S=A.width*P*A.height*P,C=0,L=b;C<L.length;C++)M=L[C],j=M[0],k=M[1],B=j*k,(O=Math.abs(S-B))<y&&(y=O,x=M);return x?(U=(T=x)[2],I=T[3],[2,[y,U,m,I]]):[2]}}))}))}var r,i,s,g,w,x,A,S,_,C,E,L,M,j,k,B,O,T,U,I,D,R,G,N,K;return t(this,(function(h){switch(h.label){case 0:if(r={},c)return[2,{tier:0,type:"SSR"}];if(i=m.isIpad,s=void 0===i?!!(null==u?void 0:u.isIpad):i,g=m.isMobile,w=void 0===g?!!(null==u?void 0:u.isMobile):g,x=m.screenSize,A=void 0===x?window.screen:x,S=m.loadBenchmarks,_=void 0===S?function(e){return n(void 0,void 0,void 0,(function(){var r;return t(this,(function(n){switch(n.label){case 0:return[4,fetch("".concat(P,"/").concat(e)).then((function(e){return e.json()}))];case 1:if(r=n.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]}}))}))}:S,C=m.renderer,E=function(e){for(var r=0,n=w?["adreno","apple","mali-t","mali","nvidia","powervr","samsung"]:["intel","apple","amd","radeon","nvidia","geforce"];r<n.length;r++){var t=n[r];if(e.includes(t))return t}},L=function(e,r,n,t,o){return{device:o,fps:t,gpu:n,isMobile:w,tier:e,type:r}},j="",C)C=a(C),M=[C];else{if(!(k=b||function(e,r){void 0===r&&(r=!1);var n={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:r,powerPreference:"high-performance",stencil:!1};e&&delete n.powerPreference;var t=window.document.createElement("canvas"),o=t.getContext("webgl",n)||t.getContext("experimental-webgl",n);return null!=o?o:void 0}(null==u?void 0:u.isSafari12,y)))return[2,L(0,"WEBGL_UNSUPPORTED")];if((B=k.getExtension("WEBGL_debug_renderer_info"))&&(C=k.getParameter(B.UNMASKED_RENDERER_WEBGL)),!C)return[2,L(1,"FALLBACK")];j=C,C=a(C),M=function(e,r,n){return"apple gpu"===r?l(e,r,n):[r]}(k,C,w)}return[4,Promise.all(M.map(e))];case 1:if(!(O=h.sent().filter(v).sort((function(e,r){var n=e[0],t=void 0===n?Number.MAX_VALUE:n,o=e[1],a=r[0],i=void 0===a?Number.MAX_VALUE:a,c=r[1];return t===i?o-c:t-i}))).length)return[2,(T=o.find((function(e){return C.includes(e)})))?L(0,"BLOCKLISTED",T):L(1,"FALLBACK","".concat(C," (").concat(j,")"))];if(U=O[0],I=U[1],D=U[2],R=U[3],-1===I)return[2,L(0,"BLOCKLISTED",D,I,R)];for(G=w?d:p,N=0,K=0;K<G.length;K++)I>=G[K]&&(N=K);return[2,L(N,"BENCHMARK",D,I,R)]}}))}))},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!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,n){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(e,n)};function n(e,r,n,t){return new(n||(n=Promise))((function(o,a){function i(e){try{u(t.next(e))}catch(e){a(e)}}function c(e){try{u(t.throw(e))}catch(e){a(e)}}function u(e){var r;e.done?o(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(i,c)}u((t=t.apply(e,r||[])).next())}))}function t(e,r){var n,t,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(u){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,t&&(o=2&c[0]?t.return:c[0]?t.throw||((o=t.return)&&o.call(t),0):t.next)&&!(o=o.call(t,c[1])).done)return o;switch(t=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,t=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=r.call(e,i)}catch(e){c=[6,e],t=0}finally{n=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,n=e.platform,t=e.maxTouchPoints,o=/(iphone|ipod|ipad)/i.test(r),a="iPad"===n||"MacIntel"===n&&t>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,n){if(!n)return[r];var t,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 ",n="\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 ",t=e.createShader(35633),o=e.createShader(35632),a=e.createProgram();if(!(o&&t&&a))return;e.shaderSource(t,r),e.shaderSource(o,n),e.compileShader(t),e.compileShader(o),e.attachShader(a,t),e.attachShader(a,o),e.linkProgram(a),e.detachShader(a,t),e.detachShader(a,o),e.deleteShader(t),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],["m1",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?t=f.filter((function(e){return e[2]>=14})):(t=f.filter((function(e){return e[1]===o}))).length||(t=f),t.map((function(e){var r=e[0];return"apple ".concat(r," gpu")}))}var f=function(e){function n(r){var n=this.constructor,t=e.call(this,r)||this;return Object.setPrototypeOf(t,n.prototype),t}return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function t(){this.constructor=e}r(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}(n,e),n}(Error);var d=[],s=[];function h(e,r){if(e===r)return 0;var n=e;e.length>r.length&&(e=r,r=n);for(var t=e.length,o=r.length;t>0&&e.charCodeAt(~-t)===r.charCodeAt(~-o);)t--,o--;for(var a,i=0;i<t&&e.charCodeAt(i)===r.charCodeAt(i);)i++;if(o-=i,0===(t-=i))return o;for(var c,u,l=0,f=0,h=0;f<t;)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<t;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 v(e){return null!=e}e.getGPUTier=function(e){var r=void 0===e?{}:e,i=r.mobileTiers,d=void 0===i?[0,15,30,60]:i,s=r.desktopTiers,p=void 0===s?[0,15,30,60]:s,g=r.override,m=void 0===g?{}:g,b=r.glContext,w=r.failIfMajorPerformanceCaveat,y=void 0!==w&&w,x=r.benchmarksURL,P=void 0===x?"https://unpkg.com/detect-gpu@".concat("5.0.38","/dist/benchmarks"):x;return n(void 0,void 0,void 0,(function(){function e(e){var o;return n(this,void 0,void 0,(function(){var n,a,i,c,u,l,d,v,p,g,m,b,y,x,P,A,C,L,M,k,j,B,R,T,U,I;return t(this,(function(t){switch(t.label){case 0:if(!(n=_(e)))return[2];a="".concat(w?"m":"d","-").concat(n).concat(s?"-ipad":"",".json"),i=r[a]=null!==(o=r[a])&&void 0!==o?o:E(a),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,i];case 2:return c=t.sent(),[3,4];case 3:if((u=t.sent())instanceof f)throw u;return[2];case 4:if(l=function(e){var r,n=(e=e.replace(/\([^)]+\)/,"")).match(/\d+/)||e.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return null!==(r=null==n?void 0:n.join("").replace(/\W|amd/g,""))&&void 0!==r?r:""}(e),(d=c.filter((function(e){return e[1]===l}))).length||(d=c.filter((function(r){return r[0].includes(e)}))),0===(v=d.length))return[2];for(p=e.split(/[.,()\[\]/\s]/g).sort().filter((function(e,r,n){return 0===r||e!==n[r-1]})).join(" "),g=v>1?d.map((function(e){return[e,h(p,e[2])]})).sort((function(e,r){return e[1]-r[1]}))[0][0]:d[0],m=g[0],b=g[4],y=Number.MAX_VALUE,P=window.devicePixelRatio,A=S.width*P*S.height*P,C=0,L=b;C<L.length;C++)M=L[C],k=M[0],j=M[1],B=k*j,(R=Math.abs(A-B))<y&&(y=R,x=M);return x?(U=(T=x)[2],I=T[3],[2,[y,U,m,I]]):[2]}}))}))}var r,i,s,g,w,x,S,A,E,C,_,L,M,k,j,B,R,T,U,I,O,D,N,F,G;return t(this,(function(h){switch(h.label){case 0:if(r={},c)return[2,{tier:0,type:"SSR"}];if(i=m.isIpad,s=void 0===i?!!(null==u?void 0:u.isIpad):i,g=m.isMobile,w=void 0===g?!!(null==u?void 0:u.isMobile):g,x=m.screenSize,S=void 0===x?window.screen:x,A=m.loadBenchmarks,E=void 0===A?function(e){return n(void 0,void 0,void 0,(function(){var r;return t(this,(function(n){switch(n.label){case 0:return[4,fetch("".concat(P,"/").concat(e)).then((function(e){return e.json()}))];case 1:if(r=n.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]}}))}))}:A,C=m.renderer,_=function(e){for(var r=0,n=w?["adreno","apple","mali-t","mali","nvidia","powervr","samsung"]:["intel","apple","amd","radeon","nvidia","geforce","adreno"];r<n.length;r++){var t=n[r];if(e.includes(t))return t}},L=function(e,r,n,t,o){return{device:o,fps:t,gpu:n,isMobile:w,tier:e,type:r}},k="",C)C=a(C),M=[C];else{if(!(j=b||function(e,r){void 0===r&&(r=!1);var n={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:r,powerPreference:"high-performance",stencil:!1};e&&delete n.powerPreference;var t=window.document.createElement("canvas"),o=t.getContext("webgl",n)||t.getContext("experimental-webgl",n);return null!=o?o:void 0}(null==u?void 0:u.isSafari12,y)))return[2,L(0,"WEBGL_UNSUPPORTED")];if(B=(null==u?void 0:u.isFirefox)?null:j.getExtension("WEBGL_debug_renderer_info"),!(C=B?j.getParameter(B.UNMASKED_RENDERER_WEBGL):j.getParameter(j.RENDERER)))return[2,L(1,"FALLBACK")];k=C,C=a(C),M=function(e,r,n){return"apple gpu"===r?l(e,r,n):[r]}(j,C,w)}return[4,Promise.all(M.map(e))];case 1:if(!(R=h.sent().filter(v).sort((function(e,r){var n=e[0],t=void 0===n?Number.MAX_VALUE:n,o=e[1],a=r[0],i=void 0===a?Number.MAX_VALUE:a,c=r[1];return t===i?o-c:t-i}))).length)return[2,(T=o.find((function(e){return C.includes(e)})))?L(0,"BLOCKLISTED",T):L(1,"FALLBACK","".concat(C," (").concat(k,")"))];if(U=R[0],I=U[1],O=U[2],D=U[3],-1===I)return[2,L(0,"BLOCKLISTED",O,I,D)];for(N=w?d:p,F=0,G=0;G<N.length;G++)I>=N[G]&&(F=G);return[2,L(F,"BENCHMARK",O,I,D)]}}))}))}})); | ||
//# sourceMappingURL=detect-gpu.umd.js.map |
@@ -58,4 +58,4 @@ export interface GetGPUTier { | ||
} | ||
export declare type TierType = 'SSR' | 'WEBGL_UNSUPPORTED' | 'BLOCKLISTED' | 'FALLBACK' | 'BENCHMARK'; | ||
export declare type TierResult = { | ||
export type TierType = 'SSR' | 'WEBGL_UNSUPPORTED' | 'BLOCKLISTED' | 'FALLBACK' | 'BENCHMARK'; | ||
export type TierResult = { | ||
tier: number; | ||
@@ -68,4 +68,4 @@ type: TierType; | ||
}; | ||
export declare type ModelEntryScreen = [number, number, number, string | undefined]; | ||
export declare type ModelEntry = [string, string, string, 0 | 1, ModelEntryScreen[]]; | ||
export type ModelEntryScreen = [number, number, number, string | undefined]; | ||
export type ModelEntry = [string, string, string, 0 | 1, ModelEntryScreen[]]; | ||
export declare const getGPUTier: ({ mobileTiers, desktopTiers, override, glContext, failIfMajorPerformanceCaveat, benchmarksURL, }?: GetGPUTier) => Promise<TierResult>; |
export declare const BLOCKLISTED_GPUS: string[]; |
export declare function cleanRenderer(renderer: string): string; |
export declare function deobfuscateAppleGPU(gl: WebGLRenderingContext, renderer: string, isMobileTier: boolean): string[]; |
export declare function deobfuscateRenderer(gl: WebGLRenderingContext | WebGL2RenderingContext, renderer: string, isMobileTier: boolean): string[]; |
@@ -5,2 +5,3 @@ export declare const deviceInfo: { | ||
isSafari12: boolean; | ||
isFirefox: boolean; | ||
} | undefined; |
export declare class OutdatedBenchmarksError extends Error { | ||
constructor(message?: string); | ||
} |
export declare function getGPUVersion(model: string): string; |
export declare function getLevenshteinDistance(left: string, right: string): number; | ||
export declare function tokenizeForLevenshteinDistance(str: string): string; |
export declare function getWebGLContext(isSafari12?: boolean, failIfMajorPerformanceCaveat?: boolean): WebGLRenderingContext | undefined; |
export declare const isSSR: boolean; |
export declare function isDefined<T>(val: T | undefined | null | void): val is T; |
{ | ||
"name": "detect-gpu", | ||
"version": "5.0.37", | ||
"version": "5.0.38", | ||
"description": "Classify GPU's based on their benchmark score in order to provide an adaptive experience.", | ||
@@ -35,3 +35,3 @@ "author": "Tim van Scherpenzeel", | ||
"scripts": { | ||
"start": "rollup -c rollup/config.lib.js -w", | ||
"start": "rollup -c rollup/config.lib.ts -w --configPlugin rollup-plugin-typescript2", | ||
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\" \"test/**/*.test.ts\" \"rollup/**/*.ts\" \"scripts/**/*.ts\" \"scripts/**/*.js\" --fix --cache --cache-location ~/.eslintcache/eslintcache", | ||
@@ -43,4 +43,4 @@ "test": "jest --verbose=false", | ||
"prebuild": "rimraf dist", | ||
"build": "rollup -c rollup/config.lib.js", | ||
"example": "rollup -w -c rollup/config.dev.ts", | ||
"build": "rollup -c rollup/config.lib.ts --configPlugin rollup-plugin-typescript2", | ||
"example": "rollup -w -c rollup/config.dev.ts --configPlugin rollup-plugin-typescript2", | ||
"parse-analytics": "node ./scripts/analytics_parser.js", | ||
@@ -53,31 +53,34 @@ "update-benchmarks": "rimraf benchmarks && mkdir -p benchmarks && mkdir -p benchmarks-min && ts-node -O '{\"module\":\"commonjs\"}' ./scripts/update_benchmarks.ts && tar -czvf benchmarks.tar.gz benchmarks-min/*.json && rm -rf benchmarks-min" | ||
"devDependencies": { | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^13.0.0", | ||
"@types/jest": "^27.0.3", | ||
"@typescript-eslint/eslint-plugin": "^5.7.0", | ||
"@typescript-eslint/parser": "^5.7.0", | ||
"@rollup/plugin-json": "^6.0.0", | ||
"@rollup/plugin-node-resolve": "^15.1.0", | ||
"@types/jest": "^29.5.3", | ||
"@typescript-eslint/eslint-plugin": "^6.4.0", | ||
"@typescript-eslint/parser": "^6.4.0", | ||
"csvtojson": "^2.0.10", | ||
"eslint": "^8.4.1", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"jest": "^27.0.4", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"jest": "^29.6.2", | ||
"jest-environment-jsdom": "^29.6.2", | ||
"moment": "^2.29.1", | ||
"prettier": "^2.3.1", | ||
"puppeteer": "^13.0.0", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.51.0", | ||
"prettier": "^3.0.1", | ||
"puppeteer": "^21.0.3", | ||
"rimraf": "^5.0.1", | ||
"rollup": "^3.28.0", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-copy": "^3.4.0", | ||
"rollup-plugin-filesize": "^9.1.1", | ||
"rollup-plugin-filesize": "^10.0.0", | ||
"rollup-plugin-livereload": "^2.0.0", | ||
"rollup-plugin-serve": "^1.1.0", | ||
"rollup-plugin-serve": "^2.0.2", | ||
"rollup-plugin-sourcemaps": "^0.6.3", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"rollup-plugin-typescript2": "^0.31.1", | ||
"ts-jest": "^27.0.2", | ||
"ts-jest": "^29.1.1", | ||
"ts-node": "^10.0.0", | ||
"typescript": "^4.3.2" | ||
"typescript": "^5.1.6" | ||
}, | ||
"jest": { | ||
"testURL": "http://localhost", | ||
"testEnvironmentOptions": { | ||
"url": "http://localhost" | ||
}, | ||
"moduleFileExtensions": [ | ||
@@ -87,7 +90,2 @@ "js", | ||
], | ||
"globals": { | ||
"ts-jest": { | ||
"tsconfig": "tsconfig.json" | ||
} | ||
}, | ||
"testMatch": [ | ||
@@ -99,4 +97,12 @@ "**/test/**/*.test.ts" | ||
], | ||
"preset": "ts-jest" | ||
"preset": "ts-jest", | ||
"transform": { | ||
"^.+\\.tsx?$": [ | ||
"ts-jest", | ||
{ | ||
"tsconfig": "tsconfig.json" | ||
} | ||
] | ||
} | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
960953
38
55057
27