laurentlb / shader-minifier

Minify and obfuscate GLSL or HLSL code
https://ctrl-alt-test.fr/minifier/
Apache License 2.0
424 stars 29 forks source link

Keep operand order when removing parens around + and - operators #406

Closed laurentlb closed 1 month ago

laurentlb commented 1 month ago

Followup to #151

This transformation preserves the order of the operands (x, y, z), but it changes the order of evaluation of the operators. This should be fine for + and -.

For the multiplication: we preserve the evaluation order of the multiplications (because of float precision), but we swap the operands only when it's pure.