Spaces:
Sleeping
Sleeping
File size: 594 Bytes
7c0f537 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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();
|