Replies: 1 comment 1 reply
-
|
Hi! Thanks for reaching out, I'll try to approach this question from two angles: Ergonomics/DX and Capability We've been really focused on GPU code having access to rich type information about the program, making use of the TypeScript language server to do the heavy lifting. When you're working with values in TypeGPU, you can hover over expressions and know what their type is. The code itself might feel more natural to read and write for JS developers too, comparing the following example: TSL: Loop({ start: ptrStart, end: ptrEnd, type: 'uint', condition: '<' }, ({ i }) => {
const springId = springListBuffer.element(i).toVar('springId');
const springForce = springForceBuffer.element(springId);
const springVertexIds = springVertexIdBuffer.element(springId );
const factor = select(springVertexIds.x.equal(instanceIndex), 1.0, -1.0);
force.addAssign(springForce.mul(factor));
});TypeGPU: for (let i = ptrStart; i < ptrEnd; i++) {
const springId = springListBuffer.$[i];
const springForce = springForceBuffer.$[springId];
const springVertexIds = springVertexIdBuffer.$[springId];
const factor = std.select(-1, 1, springVertexIds.x === idx);
force = force.add(springForce.mul(d.f32(factor)));
}When it comes to capability, our APIs map very closely to vanilla WebGPU APIs, with the added benefit that the functions you write that are pure business logic (no access to GPU resources) can be called both on the CPU and the GPU, which can be useful for unit testing and debugging. We also support calling |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am curious what TypeGPU will offer that TSL won't.
I admit I haven't looked much in TypeGPU yet, my immediate guess is:
Both points are pretty much "a more specialized tool, less bloat".
What are the other differences and use cases for which one would prefer TypeGPU?
Beta Was this translation helpful? Give feedback.
All reactions