forked from google/skia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fuse variable declarations with neighboring init-expressions.
When the optimizer is on, we look for variable declarations that are immediately followed by an initialization expression, and fuse them into one statement. (e.g.: `int i; i = 1;` can become `int i = 1;`) This benefits SkRP, since it no longer needs to zero the variable at declaration time, or apply a write-mask when initializing it. Change-Id: I7957e41ed3d4abf30b163b6f8451b24595278fe8 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/686636 Auto-Submit: John Stiles <[email protected]> Commit-Queue: John Stiles <[email protected]> Reviewed-by: Arman Uguray <[email protected]>
- Loading branch information
1 parent
a4f6149
commit d01dd1f
Showing
26 changed files
with
797 additions
and
778 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
uniform float2x2 testMatrix2x2;uniform float3x3 testMatrix3x3;uniform float4 testInputs;uniform half4 colorRed;uniform half4 colorGreen;uniform half unknownInput;bool a(){float2 e;float2 f;e=testInputs.xy;e=testInputs.xy;if(e!=testInputs.xy)return false;if(e!=testInputs.xy)return false;e=-testInputs.xy;e=-testInputs.xy;if(e!=-testInputs.xy)return false;f=float2(0.);f=float2(0.);return f==float2(0.);}bool b(){float3 f;float3 g;f=testInputs.xyz;f=testInputs.xyz;if(f!=testInputs.xyz)return false;if(f!=testInputs.xyz)return false;f=-testInputs.xyz;f=-testInputs.xyz;if(f!=-testInputs.xyz)return false;g=float3(0.);g=float3(0.);return g==float3(0.);}bool c(){float4 g;float4 h;g=testInputs;g=testInputs;if(g!=testInputs)return false;if(g!=testInputs)return false;g=-testInputs;g=-testInputs;if(g!=-testInputs)return false;h=float4(0.);h=float4(0.);return h==float4(0.);}bool d(){float2 h;float2 j;j=float2(0.);j=float2(0.);if(j!=float2(0.))return false;h=float2(1.)*testMatrix2x2;if(h!=float2(3.,7.))return false;h=testMatrix2x2*float2(1.);if(h!=float2(4.,6.))return false;h=float2(-1.)*testMatrix2x2;if(h!=float2(-3.,-7.))return false;h=testMatrix2x2*float2(-1.);return h==float2(-4.,-6.);}bool e(){float3 j;float3 k;k=float3(0.);k=float3(0.);if(k!=float3(0.))return false;j=float3(1.)*testMatrix3x3;if(j!=float3(6.,15.,24.))return false;j=testMatrix3x3*float3(1.);if(j!=float3(12.,15.,18.))return false;j=float3(-1.)*testMatrix3x3;if(j!=float3(-6.,-15.,-24.))return false;j=testMatrix3x3*float3(-1.);return j==float3(-12.,-15.,-18.);}bool f(){float4x4 k=float4x4(testMatrix2x2[0],testMatrix2x2[1],testMatrix2x2[0],testMatrix2x2[1],testMatrix2x2[0],testMatrix2x2[1],testMatrix2x2[0],testMatrix2x2[1]);float4 l;float4 m;m=float4(0.);m=float4(0.);if(m!=float4(0.))return false;l=float4(1.)*k;if(l!=float4(10.))return false;l=k*float4(1.);if(l!=float4(4.,8.,12.,16.))return false;l=float4(-1.)*k;if(l!=float4(-10.))return false;l=k*float4(-1.);return l==float4(-4.,-8.,-12.,-16.);}half4 main(float2 g){return((((a()&&b())&&c())&&d())&&e())&&f()?colorGreen:colorRed;} | ||
uniform float2x2 testMatrix2x2;uniform float3x3 testMatrix3x3;uniform float4 testInputs;uniform half4 colorRed;uniform half4 colorGreen;uniform half unknownInput;bool a(){float2 e;float2 f;e=testInputs.xy;e=testInputs.xy;if(e!=testInputs.xy)return false;if(e!=testInputs.xy)return false;e=-testInputs.xy;e=-testInputs.xy;if(e!=-testInputs.xy)return false;f=float2(0.);f=float2(0.);return f==float2(0.);}bool b(){float3 f;float3 g;f=testInputs.xyz;f=testInputs.xyz;if(f!=testInputs.xyz)return false;if(f!=testInputs.xyz)return false;f=-testInputs.xyz;f=-testInputs.xyz;if(f!=-testInputs.xyz)return false;g=float3(0.);g=float3(0.);return g==float3(0.);}bool c(){float4 g;float4 h;g=testInputs;g=testInputs;if(g!=testInputs)return false;if(g!=testInputs)return false;g=-testInputs;g=-testInputs;if(g!=-testInputs)return false;h=float4(0.);h=float4(0.);return h==float4(0.);}bool d(){float2 h;float2 j=float2(0.);j=float2(0.);if(j!=float2(0.))return false;h=float2(1.)*testMatrix2x2;if(h!=float2(3.,7.))return false;h=testMatrix2x2*float2(1.);if(h!=float2(4.,6.))return false;h=float2(-1.)*testMatrix2x2;if(h!=float2(-3.,-7.))return false;h=testMatrix2x2*float2(-1.);return h==float2(-4.,-6.);}bool e(){float3 j;float3 k=float3(0.);k=float3(0.);if(k!=float3(0.))return false;j=float3(1.)*testMatrix3x3;if(j!=float3(6.,15.,24.))return false;j=testMatrix3x3*float3(1.);if(j!=float3(12.,15.,18.))return false;j=float3(-1.)*testMatrix3x3;if(j!=float3(-6.,-15.,-24.))return false;j=testMatrix3x3*float3(-1.);return j==float3(-12.,-15.,-18.);}bool f(){float4x4 k=float4x4(testMatrix2x2[0],testMatrix2x2[1],testMatrix2x2[0],testMatrix2x2[1],testMatrix2x2[0],testMatrix2x2[1],testMatrix2x2[0],testMatrix2x2[1]);float4 l;float4 m=float4(0.);m=float4(0.);if(m!=float4(0.))return false;l=float4(1.)*k;if(l!=float4(10.))return false;l=k*float4(1.);if(l!=float4(4.,8.,12.,16.))return false;l=float4(-1.)*k;if(l!=float4(-10.))return false;l=k*float4(-1.);return l==float4(-4.,-8.,-12.,-16.);}half4 main(float2 g){return((((a()&&b())&&c())&&d())&&e())&&f()?colorGreen:colorRed;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
uniform half4 colorRed;uniform half4 colorGreen;bool a(out bool b){b=true;return false;}half4 main(float2 b){bool c;c=true;half4 d=colorGreen;half4 e=colorRed;bool f=false;bool g=(a(f),true);return(c&&f)&&g?d:e;} | ||
uniform half4 colorRed;uniform half4 colorGreen;bool a(out bool b){b=true;return false;}half4 main(float2 b){bool c=true;half4 d=colorGreen;half4 e=colorRed;bool f=false;bool g=(a(f),true);return(c&&f)&&g?d:e;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.