Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot handle transpiled imported function #825

Open
HanchaiN opened this issue Aug 20, 2023 · 0 comments
Open

Cannot handle transpiled imported function #825

HanchaiN opened this issue Aug 20, 2023 · 0 comments

Comments

@HanchaiN
Copy link

HanchaiN commented Aug 20, 2023

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?

  1. Create main.ts file.
import {calc} from "./module.ts";
import GPU from "gpu.js";

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);
  1. Create module.ts file.
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant