gpu.js
gpu.js copied to clipboard
Compiler optimisations
Some basic compile-time optimisations would be nice.
Already implemented:
- Inlining constant uniform variables
Possible optimisations:
- [x] Compiler may generate something like
decode32(encode32(x)), can easily be replaced asx - [x] Rewrite control structures to prevent branch. e.g.
if (x == 1) y += 1;toy += x*1;
Control structure rewrite methodology is covered in greater detail at : http://theorangeduck.com/page/avoiding-shader-conditionals
control structure subtask recreated as : https://github.com/gpujs/gpu.js/issues/30