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

Renaming: allow shadowing inside local blocks #382

Closed laurentlb closed 1 month ago

laurentlb commented 1 month ago

We currently do shadowing in one case: inside a function, when a global symbol is not used. We could do it in more cases, i.e. each time we enter a new scope (if-body, for-body, etc.).

For example, we could do:

int x = ...;
for(int i = 0; i < 10; i++) {
  int x = ...; // if the outer x is not used inside the for-loop
}