xref: /aosp_15_r20/external/skia/resources/sksl/shared/ArrayComparison.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1uniform half4 colorGreen, colorRed;
2uniform float[5] testArray, testArrayNegative;
3
4struct S {
5    int x, y;
6};
7
8half4 main(float2 coords) {
9    float f1[5] = float[5](1, 2, 3, 4, 5);
10    float f2[5] = float[5](1, 2, 3, 4, 5);
11    float[5] f3 = float[5](1, 2, 3, -4, 5);
12
13    int3 v1[2] = int3[2](int3(1, 2, 3), int3(4, 5, 6));
14    int3[2] v2 = int3[2](int3(1, 2, 3), int3(4, 5, 6));
15    int3 v3[2] = int3[2](int3(1, 2, 3), int3(4, 5, -6));
16
17    half2x2[3] m1 = half2x2[3](half2x2(1), half2x2(2), half2x2(3, 4, 5, 6));
18    half2x2 m2[3] = half2x2[3](half2x2(1), half2x2(2), half2x2(3, 4, 5, 6));
19    half2x2 m3[3] = half2x2[3](half2x2(1), half2x2(2, 3, 4, 5), half2x2(6));
20
21    S s1[3] = S[3](S(1, 2), S(3, 4), S(5, 6));
22    S[3] s2 = S[3](S(1, 2), S(0, 0), S(5, 6));
23    S s3[3] = S[3](S(1, 2), S(3, 4), S(5, 6));
24
25    return // same address space (function)
26           (f1 == f2) && (f1 != f3) &&
27           // same address space (uniform)
28           (testArray != testArrayNegative) &&
29           // mixed address space
30           (testArray == f1) && (testArray != f3) &&
31           // mixed address space, reverse argument order
32           (f1 == testArray) && (f3 != testArray) &&
33           (v1 == v2) && (v1 != v3) &&
34           (m1 == m2) && (m1 != m3) &&
35           (s1 != s2) && (s3 == s1) ? colorGreen : colorRed;
36}
37