2. Create `module.ts` file.
```ts
export function calc(x: number) {
return x * 2;
}
How important is this (1-5)?
4 (It is important if I want to use GPU.js here. Alternatively, I could fall back to normal CPU or manually write the shaders.)
Expected behavior (i.e. solution)
Other Comments
There is a less important issue with argumentTypes having to be an array for both addFunction and setArgumentTypes.
Noted that the replication steps are not tested. I only speculated that this will also work with just Typescript and Webpack 5 since I'm working with web framework here.
What is wrong?
Cannot handle transpiled imported function (Markup type null not handled)
Where does it happen?
I use Gatsby with Webpack 5 and Typescript and try to add functions imported from different files. The result
How do we replicate the issue?
main.ts
file.const gpu = new GPU.GPU(); const kernel = gpu.createKernel(function () { return calc(this.thread.x); }).addFunction(calc, { argumentTypes: ["Float"], returnType: "Float", }).setOutput([5]); const result = kernel(); console.log(result);
How important is this (1-5)?
4 (It is important if I want to use GPU.js here. Alternatively, I could fall back to normal CPU or manually write the shaders.)
Expected behavior (i.e. solution)
Other Comments
There is a less important issue with
argumentTypes
having to be an array for bothaddFunction
andsetArgumentTypes
. Noted that the replication steps are not tested. I only speculated that this will also work with just Typescript and Webpack 5 since I'm working with web framework here.