绘制、显示
// <canvas id="canvas"></canvas>
// var c = document.getElementById("canvas");
var c = document.createElement("canvas");
//c.width = 150; c.height = 150;
document.body.appendChild(c);
var ctx = c.getContext('2d')
ctx.strokeStyle = 'red'
ctx.strokeRect(0, 0, 100, 100)
WebGPU渲染:
实例 - https://webgpu.github.io/webgpu-samples/
const commandEncoder = device.createCommandEncoder();
const x = commandEncoder.beginRenderPass(...);
x.setPipeline(...); x.draw(3); x.end();
device.queue.submit([commandEncoder.finish()]);