diff --git a/src/rewriter.fs b/src/rewriter.fs index 925ed260..7fc97ad9 100644 --- a/src/rewriter.fs +++ b/src/rewriter.fs @@ -402,9 +402,6 @@ module private RewriterImpl = | []-> [] | Decl(ty1, li1) :: Decl(ty2, li2) :: l when ty1 = ty2 -> squeezeConsecutiveDeclarations (Decl(ty1, li1 @ li2) :: l) - // int a=2; for (int b=3; ...) -> int a=2, b=3; for (; ...) - | Decl(ty1, li1) :: ForD((ty2, li2), cond, inc, body) :: l when ty1 = ty2 -> - squeezeConsecutiveDeclarations (Decl(ty1, li1 @ li2) :: ForE(None, cond, inc, body) :: l) | e::l -> e :: squeezeConsecutiveDeclarations l // Squeeze top-level declarations, e.g. uniforms diff --git a/tests/compression_results.log b/tests/compression_results.log index b64d3285..50d3a79d 100644 --- a/tests/compression_results.log +++ b/tests/compression_results.log @@ -3,22 +3,22 @@ mouton/mouton.vert... 16726 => 2399.560 audio-flight-v2.frag 4487 => 878.327 buoy.frag 4005 => 599.099 controllable-machinery.frag 7671 => 1220.647 -ed-209.frag 7672 => 1338.529 -elevated.hlsl 3401 => 602.542 -endeavour.frag 2568 => 529.992 +ed-209.frag 7677 => 1339.532 +elevated.hlsl 3406 => 603.219 +endeavour.frag 2573 => 528.814 from-the-seas-to-the-stars.frag 14211 => 2282.423 frozen-wasteland.frag 4515 => 804.953 kinder_painter.frag 2832 => 442.132 leizex.frag 2252 => 506.309 -lunaquatic.frag 5222 => 1043.256 -mandelbulb.frag 2317 => 532.741 +lunaquatic.frag 5227 => 1044.673 +mandelbulb.frag 2322 => 532.387 ohanami.frag 3246 => 712.723 -orchard.frag 5394 => 1003.067 +orchard.frag 5399 => 1004.125 oscars_chair.frag 4648 => 986.069 -robin.frag 6196 => 1039.087 +robin.frag 6199 => 1039.306 slisesix.frag 4497 => 890.639 terrarium.frag 3575 => 747.116 the_real_party_is_in_your_pocket.frag 11986 => 1774.550 valley_ball.glsl 4307 => 881.820 yx_long_way_from_home.frag 2936 => 598.845 -Total: 133424 => 23300.612 +Total: 133457 => 23303.455 diff --git a/tests/real/ed-209.frag.expected b/tests/real/ed-209.frag.expected index 1ebdee68..3ad3700f 100644 --- a/tests/real/ed-209.frag.expected +++ b/tests/real/ed-209.frag.expected @@ -304,8 +304,8 @@ MarchData map(vec3 p) float calcShadow(vec3 p,vec3 lightPos) { lightPos=normalize(lightPos-p); - float res=1.,t=.1,i=0.; - for(;i.5)" + "float4 r=tex2D(m,s);" + "float3 w=tex2D(y,s);" + "if(r.w>.5)" "{" - "w=mul(z,float4(w.xyz,1));" - "w.y*=-1;" - "r=0;" + "r=mul(z,float4(r.xyz,1));" + "r.y*=-1;" + "w=0;" "for(float f=0;f<16;f++)" - "r.x+=tex2D(y,s+f*(.5+.5*w.xy/w.w-s)/16+float2(2,0)/1280).x,r.y+=tex2D(y,s+f*(.5+.5*w.xy/w.w-s)/16+float2(0,0)/1280).y,r.z+=tex2D(y,s+f*(.5+.5*w.xy/w.w-s)/16+float2(-2,0)/1280).z;" - "r/=16;" + "w.x+=tex2D(y,s+f*(.5+.5*r.xy/r.w-s)/16+float2(2,0)/1280).x,w.y+=tex2D(y,s+f*(.5+.5*r.xy/r.w-s)/16+float2(0,0)/1280).y,w.z+=tex2D(y,s+f*(.5+.5*r.xy/r.w-s)/16+float2(-2,0)/1280).z;" + "w/=16;" "}" - "r=(pow(r,.45)*t[2].z+t[2].y)*(.4+9.6*s.x*s.y*(1-s.x)*(1-s.y));" - "r.xz*=.98;" + "w=(pow(w,.45)*t[2].z+t[2].y)*(.4+9.6*s.x*s.y*(1-s.x)*(1-s.y));" + "w.xz*=.98;" "float D=tex2D(f,t[3].w*.1);" "s+=D;" - "r-=.005*D;" - "r.x+=.01*tex2D(f,s+=.1);" - "r.y+=.01*tex2D(f,s+=.1);" - "r.z+=.01*tex2D(f,s+=.1);" - "return float4(r,0);" + "w-=.005*D;" + "w.x+=.01*tex2D(f,s+=.1);" + "w.y+=.01*tex2D(f,s+=.1);" + "w.z+=.01*tex2D(f,s+=.1);" + "return float4(w,0);" "}"; #endif // ELEVATED_HLSL_EXPECTED_ diff --git a/tests/real/endeavour.frag.expected b/tests/real/endeavour.frag.expected index 36e0219b..328e6c3a 100644 --- a/tests/real/endeavour.frag.expected +++ b/tests/real/endeavour.frag.expected @@ -21,8 +21,8 @@ void lfnoise(vec2 t,out float num) void mfnoise(vec2 x,float fmin,float fmax,float alpha,out float num) { num=0.; - float a=1.,nf=0.,buf,f=fmin; - for(;f=1.||t>45.) break; diff --git a/tests/unit/blocks.expected b/tests/unit/blocks.expected index bd0083b8..08d4d867 100644 --- a/tests/unit/blocks.expected +++ b/tests/unit/blocks.expected @@ -18,8 +18,8 @@ const char *blocks_frag = "int k=5;" "float test_for()" "{" - "int foo=2,n=0,i=0;" - "for(;i<4;i++)" + "int foo=2,n=0;" + "for(int i=0;i<4;i++)" "foo+=i;" "for(foo++;n<4;n++)" "{" diff --git a/tests/unit/loop.frag.expected b/tests/unit/loop.frag.expected index cb8942ed..f318db6c 100644 --- a/tests/unit/loop.frag.expected +++ b/tests/unit/loop.frag.expected @@ -10,8 +10,8 @@ const char *loop_frag = "float a;" "void main()" "{" - "float c,d=0.;" - "for(;d<50.;++d)" + "float c;" + "for(float d=0.;d<50.;++d)" "c+=cos(d);" "float b;" "for(b=0.;b<50.;++b)"