-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-gpu.html
More file actions
56 lines (47 loc) · 2.56 KB
/
Copy pathcheck-gpu.html
File metadata and controls
56 lines (47 loc) · 2.56 KB
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
<!DOCTYPE html>
<html>
<head>
<title>GPU Check</title>
</head>
<body>
<h1>WebGL GPU Info</h1>
<div id="info"></div>
<script>
const canvas = document.createElement('canvas');
const gl = canvas.getContext('webgl2', {
powerPreference: 'high-performance',
antialias: true
}) || canvas.getContext('webgl', {
powerPreference: 'high-performance',
antialias: true
});
const info = document.getElementById('info');
if (gl) {
const debugInfo = gl.getExtension('WEBGL_debug_renderer_info');
let html = '<ul>';
html += '<li><strong>WebGL Version:</strong> ' + (gl instanceof WebGL2RenderingContext ? 'WebGL 2.0' : 'WebGL 1.0') + '</li>';
html += '<li><strong>Vendor:</strong> ' + gl.getParameter(gl.VENDOR) + '</li>';
html += '<li><strong>Renderer:</strong> ' + gl.getParameter(gl.RENDERER) + '</li>';
if (debugInfo) {
html += '<li><strong>Unmasked Vendor:</strong> ' + gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL) + '</li>';
html += '<li><strong>Unmasked Renderer:</strong> ' + gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL) + '</li>';
}
html += '<li><strong>Max Texture Size:</strong> ' + gl.getParameter(gl.MAX_TEXTURE_SIZE) + '</li>';
html += '<li><strong>Max Viewport Dims:</strong> ' + gl.getParameter(gl.MAX_VIEWPORT_DIMS) + '</li>';
html += '<li><strong>Max Vertex Attribs:</strong> ' + gl.getParameter(gl.MAX_VERTEX_ATTRIBS) + '</li>';
html += '<li><strong>Max Varying Vectors:</strong> ' + gl.getParameter(gl.MAX_VARYING_VECTORS) + '</li>';
html += '<li><strong>Max Fragment Uniform Vectors:</strong> ' + gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS) + '</li>';
html += '<li><strong>Max Vertex Uniform Vectors:</strong> ' + gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS) + '</li>';
html += '</ul>';
info.innerHTML = html;
// Test if using hardware acceleration
const canvas2 = document.createElement('canvas');
const context = canvas2.getContext('2d');
const imageData = context.createImageData(1, 1);
console.log('Hardware acceleration likely enabled: ' + (imageData.data.length > 0));
} else {
info.innerHTML = '<p style="color: red;">WebGL not supported!</p>';
}
</script>
</body>
</html>