我想在webgpu中render一个object,但是request device报错
Uncaught (in promise) TypeError: Cannot read property 'requestDevice' of null at cube.html:28
下面是我的代码,怎么解决这个error?
(async () => {
const [adapter, glslang] = await Promise.all([
navigator.gpu.requestAdapter(),
import(""https://unpkg.com/@webgpu/glslang@0.0.7/web/glslang.js"").then(m => m.default())
]);
const device = await adapter.requestDevice();
const canvas = document.getElementById(""webgpu-canvas"");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
})