laurentlb / shader-minifier

Minify and obfuscate GLSL or HLSL code

Home Page:https://ctrl-alt-test.fr/minifier/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Variable scoping bug

therontarigo opened this issue · comments

Testing with --no-inlining, else the problem is masked by inlining.
Input:

  vec2 r;
  int i=1;
  for (int i=2; i<3; i++) r.x=i;
  r.y=i;

Output:

  vec2 f;
  int m=1,i=2;
  for(;i<3;i++)
    f.x=i;
  f.y=i;

The last line should be f.y=m;

before 5b8f945:

  vec2 f;
  int m=1;
  for(int i=2;i<3;i++)
    f.x=i;
  f.y=m;