-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
53 lines (44 loc) · 1.37 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
<!DOCTYPE html>
<html>
<head></head>
<body>
<canvas id="renderCanvas"></canvas>
<style>
body, #renderCanvas {
margin: 0;
width: 100%;
height: 100vh;
}
</style>
<script src="https://cdn.babylonjs.com/babylon.js"></script>
<script src="radix_sort.js"></script>
<script>
// Get the canvas DOM element
var canvas = document.getElementById('renderCanvas');
// Load the 3D engine
async function createEngine() {
const webGPUSupported = await BABYLON.WebGPUEngine.IsSupportedAsync;
if (webGPUSupported) {
const engine = new BABYLON.WebGPUEngine(canvas);
await engine.initAsync();
//document.write("<H1>webGPU is supported !!");
return engine;
}
//document.write("<H1>webGPU not supported !!");
//return new BABYLON.Engine(canvas, true); // WEBGL2
}
var engine = null;
window.initFunction = async function() {
engine = await createEngine();
window.addEventListener('resize', function(){
engine.resize();
});
engine.runRenderLoop(function () {});
}
initFunction().then(() => {
// TEST HERE !!!
test(engine); // 4 ms on average
});
</script>
</body>
</html>