I’m trying to get into using WebGPU, but the documentation is practically nonexistent. I tried to look at the examples but they seem to be out of date for the version? Looking at a standard compute shader pattern that I see a lot:
const computeUpdate = Fn(() => {
const position = positionBuffer.element(instanceIndex);
const velocity = velocityBuffer.element(instanceIndex);
velocity.addAssign(vec3(0.0, gravity, 0.0));
position.addAssign(velocity);
velocity.mulAssign(friction);
// floor
If(position.y.lessThan(0), () => {
position.y = 0;
velocity.y = velocity.y.negate().mul(bounce);
// floor friction
velocity.x = velocity.x.mul(0.9);
velocity.z = velocity.z.mul(0.9);
});
});
computeParticles = computeUpdate().compute(particleCount);
This is very common for the WebGPU examples, but with the current (169) version I get the following errors:
-
No overload matches this call.
Overload 1 of 3, ‘(jsFunc: () => Node): () => Node’, gave the following error.
Argument of type ‘() => void’ is not assignable to parameter of type ‘() => Node’. -
Property ‘compute’ does not exist on type ‘Node’.ts(2339)
And this is just some of the ways that the syntax seems to be different. Is there anywhere I can find up to date resources?