Compiler Rewrites
torinmb opened this issue · comments
Torin Blankensmith commented
- change the binary ops and built-in functions we have to just return the glsl strings rather than appending it to the total source.
- make a function in regular js called "createVar(name, value)" or "assignVar(name, value)" which actually creates the line assigning a variable.
- using esprima to convert regular assignment statements (ones using any type of = symbol) to the function created in step two.
- make tweaks to the branch rewriting we already implemented and any other features we need to update so that they play nice with this new setup.
Peter Whidden commented
Turns out 1 was already supported. For 2, VariableDeclarations can be replaced with makeVar, and overwrite/update "=" type expressions can be replaced with a new "updateVar" function. "For" loops might need a special case here (should for loops be just generated in glsl without unrolling after all? This may be the only way to "break" from loops)