rewrite_mod_balanced

Function rewrite_mod_balanced 

Source
pub(crate) fn rewrite_mod_balanced(src: &str) -> String
Expand description

mod(a, b)((a) - floor((a) / (b)) * (b)). WGSL reserves mod as a keyword; HLSL uses it as the float-modulo helper. The expansion matches HLSL’s semantics (and matches GLSL’s mod) so behaviour stays identical.

Paren-balanced on both arguments because real presets ship mod(ang*16/M_PI, 1.0) and similar — the comma sits inside the call’s top-level depth.