skia2/resources/sksl/shared/GeometricIntrinsics.sksl
John Stiles abc3b78011 Eliminate left-side comma expressions without side effects.
This takes away one of our gadgets for thwarting dead-code elimination
in unit tests, but it's the right thing to do. Comma expression left-
sides without side effects are clearly dead code.

Change-Id: Iaee490b4a742d06a0a0be94cddaa69a51543d8f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366719
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2021-02-05 16:50:33 +00:00

24 lines
426 B
Plaintext

uniform half4 colorGreen;
float scalar(float x, float y) {
x = length(x);
x = distance(x, y);
x = dot(x, y);
x = normalize(x);
return x;
}
float2 vector(float2 x, float2 y) {
x = length(x).xx;
x = distance(x, y).xx;
x = dot(x, y).xx;
x = normalize(x);
return x;
}
half4 main() {
float x = scalar(1, 2);
float2 y = vector(float2(1, 2), float2(3, 4));
return colorGreen;
}