skia2/resources/sksl/shared/VectorConstructors.sksl
John Stiles 639e812d9f Remove usage of sqrt() as an optimization barrier in tests.
In the majority of cases, a uniform is an equally good substitute, and
replacing `sqrt(N)` with `unknownInput` actually makes the test clearer.

Change-Id: I7bcb477571972d7aa2ce8c49b3674471f7310748
Bug: skia:12034
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/411306
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-05-24 17:18:54 +00:00

39 lines
1.4 KiB
Plaintext

/*#pragma settings NoInline*/
uniform half4 colorGreen, colorRed;
uniform float unknownInput;
bool check(float2 v1, float2 v2, float2 v3, float3 v4, int2 v5, int2 v6, float2 v7, float2 v8,
float4 v9, int2 v10, bool4 v11, float2 v12, float2 v13, float2 v14, bool2 v15,
bool2 v16, bool3 v17) {
return half(v1.x) + half(v2.x) + half(v3.x) + half(v4.x) +
half(v5.x) + half(v6.x) + half(v7.x) + half(v8.x) +
half(v9.x) + half(v10.x) + half(v11.x) + half(v12.x) +
half(v13.x) + half(v14.x) + half(v15.x) + half(v16.x) +
half(v17.x) == 17;
}
half4 main(float2 coords) {
float2 v1 = float2(1);
float2 v2 = float2(1, 2);
float2 v3 = float2(float2(1));
float3 v4 = float3(float2(1), 1.0);
int2 v5 = int2(1);
int2 v6 = int2(float2(1, 2));
float2 v7 = float2(int2(1, 2));
float2 v8 = float2(v5);
float4 v9 = float4(v6.x, unknownInput, int2(3, 4));
int2 v10 = int2(3.14, v1.x);
bool4 v11 = bool4(bool2(true, false), true, false);
float2 v12 = float2(1.0, false);
float2 v13 = float2(false);
float2 v14 = float2(bool2(false));
bool2 v15 = bool2(1.0);
bool2 v16 = bool2(float2(1));
bool3 v17 = bool3(1.0, int2(77));
return check(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17)
? colorGreen
: colorRed;
}