Spaces:
Sleeping
Sleeping
| async function initWebGPU() { | |
| if (!navigator.gpu) { | |
| document.body.innerHTML = "<p>Your browser does not support WebGPU.</p>"; | |
| return; | |
| } | |
| const canvas = document.getElementById("webgpu-canvas"); | |
| const adapter = await navigator.gpu.requestAdapter(); | |
| const device = await adapter.requestDevice(); | |
| const context = canvas.getContext("webgpu"); | |
| context.configure({ | |
| device: device, | |
| format: navigator.gpu.getPreferredCanvasFormat(), | |
| alphaMode: "opaque", | |
| }); | |
| console.log("WebGPU initialized successfully!"); | |
| } | |
| initWebGPU(); | |