compute-engine
compute-engine copied to clipboard
[FEATURE] Overloading/removing operators, functions in box.compile()
Is your feature request related to a problem? Please describe.
When using the compile to javascript feature, its not possible to change the operators defined in NATIVE_JS_OPERATORS and functions in NATIVE_JS_FUNCTIONS. This is required to compile to environments where there are no operators like - 2+3*3 -> add(2, multiply(3,3))
Describe the solution you'd like
Add parameters in the options for compile to specify the CompileTarget interface.
This will enable overriding operators and functions.
For functions, its possible to pass them but they are compiled directly to javascript so its not possible to change the behaviour like in CompileTarget
Describe alternatives you've considered
Using the compileTarget directly, but it's not exported. Also since box.compile() is the entry-point, it should be possible to override based on that.
Additional context Also I wrote a compiler for GLSL, it's in a fork right now since required many changes, but this would make it easy to work on that and maybe get that merged easily.