forked from pmndrs/detect-gpu
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
98 lines (90 loc) · 3.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<title>Detect GPU</title>
</head>
<body>
<pre id="app"></pre>
<script src="./dist/detect-gpu.umd.js"></script>
<script>
/*! https://mths.be/includes v1.0.0 by @mathias */
if (!String.prototype.includes) {
(function() {
'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
var toString = {}.toString;
var defineProperty = (function() {
// IE 8 only supports `Object.defineProperty` on DOM elements
try {
var object = {};
var $defineProperty = Object.defineProperty;
var result = $defineProperty(object, object, object) && $defineProperty;
} catch (error) {}
return result;
})();
var indexOf = ''.indexOf;
var includes = function(search) {
if (this == null) {
throw TypeError();
}
var string = String(this);
if (search && toString.call(search) == '[object RegExp]') {
throw TypeError();
}
var stringLength = string.length;
var searchString = String(search);
var searchLength = searchString.length;
var position = arguments.length > 1 ? arguments[1] : undefined;
// `ToInteger`
var pos = position ? Number(position) : 0;
if (pos != pos) {
// better `isNaN`
pos = 0;
}
var start = Math.min(Math.max(pos, 0), stringLength);
// Avoid the `indexOf` call if no match is possible
if (searchLength + start > stringLength) {
return false;
}
return indexOf.call(string, searchString, pos) != -1;
};
if (defineProperty) {
defineProperty(String.prototype, 'includes', {
value: includes,
configurable: true,
writable: true,
});
} else {
String.prototype.includes = includes;
}
})();
}
// var attributes = {
// alpha: false,
// antialias: false,
// depth: false,
// failIfMajorPerformanceCaveat: true,
// powerPreference: 'high-performance',
// stencil: false,
// };
// var canvas = document.createElement('canvas');
// var gl =
// canvas.getContext('webgl', attributes) ||
// canvas.getContext('experimental-webgl', attributes);
var GPUTier = DetectGPU.getGPUTier({
// glContext: gl,
// mobileBenchmarkPercentages: [15, 35, 30, 20],
// desktopBenchmarkPercentages: [15, 35, 30, 20],
// forceRendererString: 'ANGLE (NVIDIA GeForce GTX 1060 6GB Direct3D11 vs_5_0 ps_5_0)',
// forceMobile: true,
});
document
.getElementById('app')
.appendChild(
document.createTextNode('Tier: ' + GPUTier.tier + '\n' + 'Type: ' + GPUTier.type)
);
</script>
</body>
</html>