Add coords parameter to all .sksl test files used as runtime effects

Convert to use the newer MakeForShader factory, which requires this.

Change-Id: Ifaf6054054027c78f3f3fe15596e435e0f79b877
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399336
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This commit is contained in:
Brian Osman 2021-04-21 14:27:08 -04:00 committed by Skia Commit-Bot
parent 0188b3422b
commit 22dcb5fd7e
207 changed files with 10117 additions and 9667 deletions

View File

@ -8,7 +8,7 @@ bool test() {
return (x == xx) && !(x != xx) && (x != y) && !(x == y);
}
half4 main() {
half4 main(float2 coords) {
return test() ? colorGreen : colorRed;
}

View File

@ -1,6 +1,6 @@
uniform half4 colorRed, colorGreen;
half4 main() {
half4 main(float2 coords) {
bool ok = true;
int a = 1;

View File

@ -15,7 +15,7 @@ bool test() {
return a && !b && c && !d && e && !f && g && !h && i && !j;
}
half4 main() {
half4 main(float2 coords) {
return test() ? colorGreen : colorRed;
}

View File

@ -75,6 +75,6 @@ bool test() {
return ok;
}
half4 main() {
half4 main(float2 coords) {
return test() ? colorGreen : colorRed;
}

View File

@ -74,6 +74,6 @@ bool test() {
return ok;
}
half4 main() {
half4 main(float2 coords) {
return test() ? colorGreen : colorRed;
}

View File

@ -21,6 +21,6 @@ bool test() {
return ok;
}
half4 main() {
half4 main(float2 coords) {
return test() ? colorGreen : colorRed;
}

View File

@ -35,6 +35,6 @@ bool test() {
return ok;
}
half4 main() {
half4 main(float2 coords) {
return test() ? colorGreen : colorRed;
}

View File

@ -6,6 +6,6 @@ bool test() {
return ok;
}
half4 main() {
half4 main(float2 coords) {
return test() ? colorGreen : colorRed;
}

View File

@ -5,7 +5,7 @@ struct S {
half j;
};
half4 main() {
half4 main(float2 coords) {
// All of these assignments can be preserved.
half4 x = half4(3, 2, 1, 0);
x.xyz = x.zyx;

View File

@ -42,6 +42,6 @@ bool test() {
return ok == 22 && bad == 0;
}
half4 main() {
half4 main(float2 coords) {
return test() ? colorGreen : colorRed;
}

View File

@ -203,6 +203,6 @@ bool test_int() {
return ok;
}
half4 main() {
half4 main(float2 coords) {
return test_half() && test_int() ? colorGreen : colorRed;
}

View File

@ -127,6 +127,6 @@ bool test_int() {
return ok;
}
half4 main() {
half4 main(float2 coords) {
return test_half() && test_int() ? colorGreen : colorRed;
}

View File

@ -5,7 +5,7 @@ inline half4 get() {
return x;
}
half4 main() {
half4 main(float2 coords) {
half4 result = colorRed;
do
result = get();

View File

@ -4,7 +4,7 @@ inline bool shouldLoop(half4 value) {
return value != colorGreen;
}
half4 main() {
half4 main(float2 coords) {
half4 result = colorRed;
do {
result = colorGreen;

View File

@ -2,7 +2,7 @@ uniform half4 colorGreen, colorRed;
half4 helper();
half4 main() {
half4 main(float2 coords) {
return helper();
}

View File

@ -5,7 +5,7 @@ inline half4 multiply(half4 x, half y) {
return value;
}
half4 main() {
half4 main(float2 coords) {
half4 result;
for (int x=0; x<4; ++x)
result = multiply(colorGreen, 1);

View File

@ -12,7 +12,7 @@ inline half4 grow(half4 v) {
return v + half4(0.125);
}
half4 main() {
half4 main(float2 coords) {
for (sk_FragColor = initLoopVar();
shouldLoop(sk_FragColor);
sk_FragColor = grow(sk_FragColor)) {

View File

@ -7,6 +7,6 @@ inline half4 loopy() {
return colorRed;
}
half4 main() {
half4 main(float2 coords) {
return loopy();
}

View File

@ -8,6 +8,6 @@ inline half4 loopy() {
return result;
}
half4 main() {
half4 main(float2 coords) {
return loopy();
}

View File

@ -5,7 +5,7 @@ inline half4 ifBody() {
return x;
}
half4 main() {
half4 main(float2 coords) {
half4 c = colorRed;
if (colorGreen.g == 1)
c = ifBody();

View File

@ -5,7 +5,7 @@ inline half4 elseBody() {
return x;
}
half4 main() {
half4 main(float2 coords) {
half4 c = colorRed;
if (colorGreen.g == 0)
;

View File

@ -26,6 +26,6 @@ inline half branchyAndBlocky() {
}}}
}
half4 main() {
half4 main(float2 coords) {
return bool(branchy() * branchyAndBlocky()) ? colorGreen : colorRed;
}

View File

@ -5,7 +5,7 @@ inline bool ifTest(half4 color) {
return result;
}
half4 main() {
half4 main(float2 coords) {
if (ifTest(colorGreen))
return colorGreen;
else

View File

@ -4,6 +4,6 @@ half4 branchy(half4 c) {
if (colorGreen == colorRed) return colorRed; else return colorGreen;
}
half4 main() {
half4 main(float2 coords) {
return branchy(colorGreen);
}

View File

@ -6,7 +6,7 @@ inline int tooBig(int x) {
return x;
}
half4 main() {
half4 main(float2 coords) {
int y = 0;
y = tooBig(y);
y = tooBig(y);

View File

@ -5,7 +5,7 @@ void tooBig(inout int x) {
++x; ++x; ++x; ++x; ++x; ++x; ++x; ++x; ++x; ++x; ++x; ++x; ++x; ++x; ++x; ++x; ++x;
}
half4 main() {
half4 main(float2 coords) {
int x = 0;
tooBig(x);
tooBig(x);

View File

@ -5,7 +5,7 @@ inline void outParameter(inout half4 x) {
x *= x;
}
half4 main() {
half4 main(float2 coords) {
half4 c = colorGreen;
outParameter(c);
return c;

View File

@ -5,7 +5,7 @@ inline half parameterWrite(half x) {
return x;
}
half4 main() {
half4 main(float2 coords) {
half4 c = colorGreen;
c.g = parameterWrite(c.g);
return c;

View File

@ -12,6 +12,6 @@ inline half BigY(half x) {
return x;
}
half4 main() {
half4 main(float2 coords) {
return BigX(BigY(12345)).0x0x;
}

View File

@ -2,7 +2,7 @@ inline half square(half x) {
return x * x;
}
half4 main() {
half4 main(float2 coords) {
half one = 1;
half4 result = half4(123);
result.r = square(0);

View File

@ -6,6 +6,6 @@ half4 blocky(half4 c) {
}
}
half4 main() {
half4 main(float2 coords) {
return blocky(colorGreen);
}

View File

@ -10,7 +10,7 @@ inline half2 InlineA()
return InlineB(reusedName);
}
half4 main()
half4 main(float2 coords)
{
return InlineA().xyxy;
}

View File

@ -12,6 +12,6 @@ inline half4 MakeTempVar(half4 c) {
}
}
half4 main() {
half4 main(float2 coords) {
return MakeTempVar(colorRed);
}

View File

@ -6,7 +6,7 @@ bool out_params_are_distinct(out half x, out half y) {
return x == 1 && y == 2;
}
half4 main() {
half4 main(float2 coords) {
half x = 0;
return out_params_are_distinct(x, x) ? colorGreen : colorRed;
}

View File

@ -13,7 +13,7 @@ half fma(half a, half b, half c) {
return add(mul(a, b), c);
}
half4 main() {
half4 main(float2 coords) {
half a = fma(color.x, color.y, color.z);
half b = fma(color.y, color.z, color.w);
half c = fma(color.z, color.w, color.x);

View File

@ -10,6 +10,6 @@ inline half4 MakeTempVar(half4 c) {
}
}
half4 main() {
half4 main(float2 coords) {
return MakeTempVar(colorWhite);
}

View File

@ -9,6 +9,6 @@ inline half4 MakeTempVar(half4 c) {
}
}
half4 main() {
half4 main(float2 coords) {
return MakeTempVar(colorWhite);
}

View File

@ -17,7 +17,7 @@ noinline half fma(half a, half b, half c) {
return add(mul(a, b), c);
}
half4 main() {
half4 main(float2 coords) {
// Functions used multiple times:
half4 result = fma(colorGreen.a, colorGreen.g, colorGreen.r).0x0x;
// Functions used only once:

View File

@ -8,7 +8,7 @@ inline bool testB(half4 v) {
return bool(v.g);
}
half4 main() {
half4 main(float2 coords) {
half4 result = half4(0);
if (testA(colorWhite) && testB(colorWhite)) {
result.g = 1;

View File

@ -11,7 +11,7 @@ float get() {
return abs(5);
}
half4 main() {
half4 main(float2 coords) {
float result = get();
return result == 2 ? colorGreen : colorRed;
}

View File

@ -14,6 +14,6 @@ half4 helper() {
return half4(c.red, c.green, c.blue, c.alpha);
}
half4 main() {
half4 main(float2 coords) {
return helper();
}

View File

@ -4,6 +4,6 @@ half4 switchRedAndGreen(half4 v) {
return v.grba;
}
half4 main() {
half4 main(float2 coords) {
return switchRedAndGreen(switchRedAndGreen(switchRedAndGreen(colorRed)));
}

View File

@ -8,6 +8,6 @@ inline half4 falseSide(half4 v) {
return v.r0ba;
}
half4 main() {
half4 main(float2 coords) {
return bool(colorGreen.g) ? trueSide(colorGreen) : falseSide(colorRed);
}

View File

@ -4,6 +4,6 @@ inline bool test(half4 v) {
return bool(v.g);
}
half4 main() {
half4 main(float2 coords) {
return test(colorGreen) ? colorGreen : colorRed;
}

View File

@ -30,7 +30,7 @@ half4 func4(half4 h4) {
return h4 * h4;
}
half4 main() {
half4 main(float2 coords) {
S s;
s.ah4[0] = half4(unknownInput);
s.ah[0] = unknownInput;

View File

@ -5,7 +5,7 @@ inline half4 green() {
return x;
}
half4 main() {
half4 main(float2 coords) {
half4 result = colorRed;
while (result != colorGreen)
result = green();

View File

@ -4,7 +4,7 @@ inline bool shouldLoop(half4 v) {
return v != colorGreen;
}
half4 main() {
half4 main(float2 coords) {
half4 result = colorRed;
while (shouldLoop(result)) {
result = colorGreen;

View File

@ -1,7 +1,7 @@
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
half4 expected = half4(1.25, 0, 0.75, 2.25);
return (abs(testInputs.x) == expected.x &&
abs(testInputs.xy) == expected.xy &&

View File

@ -1,7 +1,7 @@
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
int4 expected = int4(1, 0, 0, 2);
return (abs(int4(testInputs).x) == expected.x &&
abs(int4(testInputs).xy) == expected.xy &&

View File

@ -1,7 +1,7 @@
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
half4 expected = half4(-1, 0, 1, 3);
return (ceil(testInputs.x) == expected.x &&
ceil(testInputs.xy) == expected.xy &&

View File

@ -1,7 +1,7 @@
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
half4 expectedA = half4(-1, 0, 0.75, 1);
// (-1.25, 0, 0.75, 2.25)

View File

@ -1,7 +1,7 @@
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
int4 expectedA = int4(-100, 0, 75, 100);
int4 intValues = int4(testInputs * 100);

View File

@ -1,7 +1,7 @@
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
half4 expected = half4(-2, 0, 0, 2);
return (floor(testInputs.x) == expected.x &&
floor(testInputs.xy) == expected.xy &&

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
float4 value = colorGreen.gggg * 6;
int4 exp;
float4 result;

View File

@ -1,7 +1,7 @@
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
half4 expectedA = half4(0.5, 0.5, 0.75, 2.25);
half4 expectedB = half4(0, 1, 0.75, 2.25);
return (max(testInputs.x, 0.5) == expectedA.x &&

View File

@ -1,7 +1,7 @@
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
int4 intValues = int4(testInputs * 100);
int4 intGreen = int4(colorGreen * 100);

View File

@ -1,7 +1,7 @@
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
half4 expectedA = half4(-1.25, 0, 0.5, 0.5);
half4 expectedB = half4(-1.25, 0, 0, 1);
return (min(testInputs.x, 0.5) == expectedA.x &&

View File

@ -1,7 +1,7 @@
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
int4 intValues = int4(testInputs * 100);
int4 intGreen = int4(colorGreen * 100);

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen, colorRed, colorBlack, colorWhite, testInputs;
half4 main() {
half4 main(float2 coords) {
int4 intGreen = int4(colorGreen * 100);
int4 intRed = int4(colorRed * 100);

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen, colorRed, colorBlack, colorWhite, testInputs;
half4 main() {
half4 main(float2 coords) {
half4 expectedBW = half4(0.5, 0.5, 0.5, 1);
half4 expectedWT = half4(1, 0.5, 1, 2.25);

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
float4 value = colorGreen.gggg * 2.5;
float4 whole, fraction;
bool4 ok;

View File

@ -1,7 +1,7 @@
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
half4 expected = half4(-1, 0, 1, 1);
return (sign(testInputs.x) == expected.x &&
sign(testInputs.xy) == expected.xy &&

View File

@ -1,7 +1,7 @@
uniform half4 minus1234;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
int4 expected = int4(-1, 0, 0, 1);
return (sign(int4(testInputs).x) == expected.x &&
sign(int4(testInputs).xy) == expected.xy &&

View File

@ -4,7 +4,7 @@ struct S {
int x, y;
};
half4 main() {
half4 main(float2 coords) {
float f1[4] = float[4](1, 2, 3, 4);
float f2[4] = float[4](1, 2, 3, 4);
float f3[4] = float[4](1, 2, 3, -4);

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
float test1[4] = float[4](1, 2, 3, 4);
float2 test2[2] = float2[2](float2(1, 2), float2(3, 4));
float4x4 test3[1] = float4x4[1](float4x4(16));

View File

@ -1,4 +1,4 @@
half4 main() {
half4 main(float2 coords) {
float2 x[2];
x[0] = float2( 0, 0);
x[1] = float2( 1, 0);

View File

@ -10,7 +10,7 @@ struct S {
half4 globalVar;
S globalStruct;
half4 main() {
half4 main(float2 coords) {
/* assign to scalar */ int i; i = 0;
/* assign to vector */ int4 i4; i4 = int4(1,2,3,4);
/* assign to matrix */ float3x3 f3x3; f3x3 = float3x3(1,2,3,4,5,6,7,8,9);

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
bool ok = true;
ok = ok && (half4(int4(0, 0, 1, 2)) == half4(int4(half4(0.01, 0.99, 1.49, 2.75))));
ok = ok && (half4(int4(0, 0, -1, -2)) == half4(int4(half4(-0.01, -0.99, -1.49, -2.75))));

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen;
half4 main() {
half4 main(float2 coords) {
half4 result;
result.x = (sqrt(1), colorGreen.x);
result.y = (float2(2), colorGreen.y);

View File

@ -6,7 +6,7 @@ void setToColorBlack(out half4 x) {
x = colorBlack;
}
half4 main() {
half4 main(float2 coords) {
half4 a, b, c, d;
(b = colorRed), (c = colorGreen);

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
const float4 a = float4(0);
const float4 b = float4(1);
// This is a constant-expression in GLSL, but not in SkSL (yet).

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
int a = 0, b = 0, c = 0, d = 0;
if (true) a = 1;
if (2 > 1) b = 2; else b = 3;

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
const bool x = true;
if (!x) return colorRed;
if (x) return colorGreen;

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen;
half4 main() {
half4 main(float2 coords) {
for (int x = 0; x < 4; ) {
break;
}

View File

@ -10,7 +10,7 @@ half4 live_fn(half4 a, half4 b) {
return a + b;
}
half4 main() {
half4 main(float2 coords) {
const bool TRUE = true, FALSE = false;
half4 a, b;

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
float x = 0.5, y = x * 2;
return (y == 1) ? colorGreen : colorRed;
}

View File

@ -1,4 +1,4 @@
half4 main() {
half4 main(float2 coords) {
half4 x = half4(1, 1, 1, 1);
// Verify that break is allowed in a do-while loop.

View File

@ -1,4 +1,4 @@
half4 main() {
half4 main(float2 coords) {
half4 color = half4(0);
for (int counter=0; counter<10; ++counter) ;

View File

@ -1,4 +1,4 @@
half4 main() {
half4 main(float2 coords) {
half4 color = half4(0);
for (int counter=0; counter<10; ++counter) ;

View File

@ -1,6 +1,6 @@
uniform half4 colorWhite;
half4 main() {
half4 main(float2 coords) {
half4 x = colorWhite;
// Verify that break is allowed in a for loop.

View File

@ -1,4 +1,4 @@
half4 main() {
half4 main(float2 coords) {
half4 result = half4(0);
// Two variables, both used

View File

@ -23,7 +23,7 @@ bool takes_int2 (int2 x) { return true; }
bool takes_int3 (int3 x) { return true; }
bool takes_int4 (int4 x) { return true; }
half4 main() {
half4 main(float2 coords) {
return takes_float (float (1)) &&
takes_float2 (float2 (2)) &&
takes_float3 (float3 (3)) &&

View File

@ -10,7 +10,7 @@ half4 this_function_is_defined_before_use(half4 x) {
bool this_function_is_prototyped_in_the_middle_and_never_defined(float4x4 a);
half4 main() {
half4 main(float2 coords) {
return this_function_is_defined_after_use(this_function_is_defined_before_use(colorGreen));
}

View File

@ -23,7 +23,7 @@ int2 returns_int2() { return int2(2); }
int3 returns_int3() { return int3(3); }
int4 returns_int4() { return int4(4); }
half4 main() {
half4 main(float2 coords) {
float x1 = returns_float();
float2 x2 = returns_float2();
float3 x3 = returns_float3();

View File

@ -13,7 +13,7 @@ void bar(inout float x) {
x = foo(float2(y[0], y[1]));
}
half4 main() {
half4 main(float2 coords) {
float x = 10;
bar(x);
return x == 200 ? colorGreen : colorRed;

View File

@ -16,7 +16,7 @@ float2 vector(float2 x, float2 y) {
return x;
}
half4 main() {
half4 main(float2 coords) {
float x = scalar(1, 2);
float2 y = vector(float2(1, 2), float2(3, 4));
return colorGreen;

View File

@ -1 +1 @@
half4 main() { return half4(0, 1, 0, 1); }
half4 main(float2 coords) { return half4(0, 1, 0, 1); }

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen;
half4 main() {
half4 main(float2 coords) {
int i1 = 0x0;
i1++;
int i2 = 0x1234;

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen;
half4 main() {
half4 main(float2 coords) {
uint u1 = 0x0;
u1++;
uint u2 = 0x1234abcd;

View File

@ -42,6 +42,6 @@ bool test_half() {
return true;
}
half4 main() {
half4 main(float2 coords) {
return test_float() && test_half() ? colorGreen : colorRed;
}

View File

@ -30,6 +30,6 @@ bool test_half() {
return true;
}
half4 main() {
half4 main(float2 coords) {
return test_float() && test_half() ? colorGreen : colorRed;
}

View File

@ -11,6 +11,6 @@ bool test_equality() {
return ok;
}
half4 main() {
half4 main(float2 coords) {
return test_equality() ? colorGreen : colorRed;
}

View File

@ -1,4 +1,4 @@
half4 main() {
half4 main(float2 coords) {
float x;
float y;
x = y = 1;

View File

@ -26,6 +26,6 @@ bool test_int() {
return bool(-(-result.r) * result.g * result.b * result.a);
}
half4 main() {
half4 main(float2 coords) {
return test_float() && test_int() ? colorGreen : colorRed;
}

View File

@ -1,4 +1,4 @@
half4 main() {
half4 main(float2 coords) {
bool3 B;
B.x = bool(1.23);
B.y = bool(1);

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
float x = 1, y = 2;
int z = 3;
x = x - x + y * x * x * (y - x);

View File

@ -1,6 +1,6 @@
uniform half4 colorGreen, colorRed;
half4 main() {
half4 main(float2 coords) {
float x = 1, y = 2;
int z = 3;
x = x - x + y * x * x * (y - x);

View File

@ -28,7 +28,7 @@ void out_bool2(out bool2 v) { v = bool2(colorWhite.g); }
void out_bool3(out bool3 v) { v = bool3(colorWhite.b); }
void out_bool4(out bool4 v) { v = bool4(colorWhite.a); }
half4 main() {
half4 main(float2 coords) {
half4 result;
half h; out_half (h);

View File

@ -30,7 +30,7 @@ void out_bool2(out bool2 v) { v = bool2(colorWhite.g); }
void out_bool3(out bool3 v) { v = bool3(colorWhite.b); }
void out_bool4(out bool4 v) { v = bool4(colorWhite.a); }
half4 main() {
half4 main(float2 coords) {
half4 result;
half h; out_half (h);

View File

@ -12,7 +12,7 @@ void func(inout half4 color) {
color.ga = t;
}
half4 main() {
half4 main(float2 coords) {
half4 result = half4(0, 1, 2, 3);
func(result);
return result == half4(2, 3, 0, 5) ? colorGreen : colorRed;

Some files were not shown because too many files have changed in this diff Show More