stackgl / glsl-transpiler

Transpile GLSL to JS
http://stackgl.github.io/glsl-transpiler/
175 stars 21 forks source link

Use WASM as the target? #31

Open drom opened 7 years ago

drom commented 7 years ago

asm.js: http://asmjs.org/spec/latest/ Is supported chrome and firefox for quite some time. Does it make sense generate it?

dy commented 7 years ago

There is unfinished https://github.com/devongovett/glsl.js which attempted that. Practically there are cases where we use Array.prototype.map and other env methods. Not sure that goes well with asm.js. Should understand that main performance drop is not because of suboptimal js, but due to absence of huge parallelism, like in GPU.

drom commented 7 years ago

@dfcreative agree, that the main performance drop is because of CPU is not GPU, but 2x average improvement maybe worth pursuing. Here is my comparison of asm / non-asm version of FFT: https://github.com/drom/fourier/issues/1

dy commented 7 years ago

Interesting! Would be nice to make comparative benchmark over various implementations As for glsl-transpiler, I am not sure there is anyone using it at all before making any serious changes. Because webgl is too well supported across all platforms.

drom commented 7 years ago

@dfcreative I see that my package is already in the list ;)

dy commented 7 years ago

@drom your benchmarks are way more dependable and demonstrative :)

drom commented 7 years ago

@dfcreative I need to rerun it with node v6 / v7 There is some difference depend on the engine.

gre commented 7 years ago

mmh but what about WebAssembly? 🙂 I agree there is not much room for a real usecase (webgl is widely supported now!) but it would be fun just for the exercise of learning WebAssembly

dy commented 7 years ago

@gre I am watching for the WebAssembly area, do you have any easy getting-started resources by any chance? Seems like entry barrier is too expensive for ordinary js-developer

gre commented 7 years ago

yeah I don't have A LOT of experience in it frankly, but i've found these series of article quite interesting: https://hacks.mozilla.org/2017/02/a-cartoon-intro-to-webassembly/

dy commented 7 years ago

@gre as far as I get this, wasm can be compiled from asm.js via wasm.

jamen commented 7 years ago

I've been learning and implement WASM the past week or so for Elixir. It has been quite fun! My main resource so far has just been everything Web Assembly has put out.

What I can say from my limited experience: The spec only describes a few basic values, some instructions for working with them, and a module format to define the program and reusability. There is some typing aspect to it, and also validation, but I haven't delved that deep myself.

It does seem to be quite early though and still active in development (the binary format wasn't in the spec when I first started investigating!) so it is probably worth watching the repos to see that discussion. Note that they have several repos dedicated to sections of the spec like webassembly/gc for garbage collection, and so on.

Hope this helps and I hope to collab on some WASM stuff with people!

dy commented 1 year ago

Can be done via lino, which can be a better fit