FAAM-demo / src /main.js
KasKniesmeijer's picture
first commit
7c0f537
raw
history blame
594 Bytes
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();