-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
test_wgpu.html
56 lines (49 loc) · 1.72 KB
/
test_wgpu.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>INOX WebGPU</title>
<style>
html,
body {
margin: 0;
overflow: hidden;
width: 100%;
height: 100%;
}
canvas {
width: 100vw !important;
height: 100vh !important;
aspect-ratio: 16 / 9;
}
</style>
</head>
<body>
<noscript>This page contains webassembly and javascript content, please enable javascript in your
browser.</noscript>
<canvas id="canvas" width="1280" height="720" style='position: absolute;'></canvas>
<script type="module">
import init from './web/inox_launcher.js';
import { send_event_from_string } from './web/inox_launcher.js';
var canvas = document.getElementById('canvas');
const scale = window.devicePixelRatio; // Change to 1 on retina screens to see blurry canvas.
canvas.width = Math.floor(canvas.width * scale);
canvas.height = Math.floor(canvas.height * scale);
var context = canvas.getContext('webgpu');
if (!context) {
const span = document.createElement('span');
span.innerText = 'Your browser does not seem to support WebGPU';
document.body.appendChild(span);
} else {
window.addEventListener("load", () => {
//init();
init().then(wasm => {
var s = '-load_file models/cornell_box/cornell_box.scene';
send_event_from_string(s);
}).catch(console.error);
});
}
</script>
</body>
</html>