index.html 857 B

1234567891011121314151617181920212223
  1. <!DOCTYPE html>
  2. <html lang="en" style="height: 100%;">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>WGPU WASM Triangle</title>
  7. </head>
  8. <body id="body" style="height: 100%; padding: 0; margin: 0; overflow: hidden;">
  9. <canvas id="wgpu-canvas"></canvas>
  10. <script type="text/javascript" src="runtime.js"></script>
  11. <script type="text/javascript" src="wgpu.js"></script>
  12. <script type="text/javascript">
  13. const mem = new WebAssembly.Memory({ initial: 2000, maximum: 65536, shared: false });
  14. const memInterface = new odin.WasmMemoryInterface();
  15. memInterface.setMemory(mem);
  16. const wgpuInterface = new odin.WebGPUInterface(memInterface);
  17. odin.runWasm("triangle.wasm", null, { wgpu: wgpuInterface.getInterface() }, memInterface, /*intSize=8*/);
  18. </script>
  19. </body>
  20. </html>