gpu.js icon indicating copy to clipboard operation
gpu.js copied to clipboard

Compiler optimisations

Open fuzzie360 opened this issue 10 years ago • 1 comments

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 as x
  • [x] Rewrite control structures to prevent branch. e.g. if (x == 1) y += 1; to y += x*1;

fuzzie360 avatar Feb 19 '16 15:02 fuzzie360

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

PicoCreator avatar Apr 19 '16 10:04 PicoCreator