rename_reserved_identifiers

Function rename_reserved_identifiers 

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

Rename WGSL-reserved keywords used by MD2 preset authors as locals (mod, filter, sample). Every occurrence on a word boundary that isn’t immediately followed by ( (a function call — already rewritten by rewrite_mod_balanced or rejected upstream) gets a trailing _.

This stays consistent across one shader: a local float mod = …; and its later references in + q22*sqrt(z)/4*mod * both become mod_, so the renamed variable still ties together correctly.