-
Notifications
You must be signed in to change notification settings - Fork 1
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
Exports from modules #3
Comments
I don't exactly recall why I fell into this pattern of exporting functions this way. import { setWebGLContext, getWebGLContext, isWebGL2 } from "./context";
module.exports = {
setWebGLContext,
getWebGLContext,
isWebGL2,
};
export { setWebGLContext, getWebGLContext, isWebGL2 } from "./context"; I recall that for some reason I needed to export things twice.
|
I like the general idea of your project, but fortunately it seems that WebGPU (which should allow making computations a way, way easier) is already pretty close on horizon. Yesterday saw news that it is already available in Firefox nightly (so it should be in some form available in stable release in 12 weeks). |
I'm definitely going to transition to WebGPU. Right now I see the following advantages:
WebGL 1.0 supported ancient hardware (SM 3.0) and had to make some insane compromises. For example - for loop headers must only contain constant expressions. Also, some GPUs of that era didn't implement integer arithmetic and that resulted in bitwise operators being omitted from the spec. And get this - in those older environments the result of division doesn't get truncated! What a mess. |
In terms of WebGPU I'm thinking actually of making static transpiller inside my TypeScript bundler I'm currently working on. (basically that is a reason why I've found your project :-) ) I would be way more happy to get all GPU code ready at (typescript) compile time. This is my simple sketch of what would I like to have as transpillation input from developer: const computer = COMPUTE_ZONE(() => {
let inputData: U32[] = []; // let allows to assign data with update function
const notChangeable: F32 = 20
const transformData = MAPPER((dataElement: U32, result: U32, inputData?: U32[]) => {
result = dataElement
});
const populateNewData = POPULATER((index: U32, result: U32) => {
});
const mainProgram = PROGRAM(()=> {
const dataPopulated = populateNewData(100);
const dataTransformed = transformData(inputData, dataPopulated);
return dataTransformed; // can be skipped and then data will not be returned by run method
})
})
computer.update('inputData', []); // will update gpu buffer defined above as 'let inputData'
const result = computer.run('mainProgram'); As output would have all (and only) necessary code to handle given computations. |
That reminds me of GPU.js but with the transpilation done at runtime. Transpiling the code before it hits TSC sounds like a good idea. You'd be able to use all the type hints that Typescript provides. |
I've noticed that you use everywhere something like this:
Do you know that you can do it like that:
:-)
The text was updated successfully, but these errors were encountered: