Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / skia / resources / sksl / folding / Negation.sksl
1 uniform half4 colorGreen, colorRed;
2
3 bool test_fvec() {
4     const float one = 1;
5     float two = 2;
6     const half4 one_splat = half4(1);
7     const half4 one_compound = half4(1, 1, 1, 1);
8
9     bool ok = true;
10     ok = ok && (half4(-1) == -one_splat);
11     ok = ok && (half4(-1, -1, -1, -1) == -one_splat);
12     ok = ok && (half4(-1) == -one_compound);
13     ok = ok && (half4(-1, -1, -1, -1) == -one_compound);
14     ok = ok && (-half4(1) == -one_splat);
15     ok = ok && (-half4(1, 1, 1, 1) == -one_splat);
16     ok = ok && (-half4(1) == -one_compound);
17     ok = ok && (-half4(1, 1, 1, 1) == -one_compound);
18     ok = ok && (half4(-1) == -one_compound);
19     ok = ok && (half4(-1) == -half4(-half2(-1), half2(1)));
20     ok = ok && (half4(1) != -half4(1));
21     ok = ok && (-half4(two) == half4(-two, half3(-two)));
22     ok = ok && (-half2(-one, one + one) == -half2(one - two, two));
23     ok = ok && (-1 * one == -one);
24     ok = ok && (-two == -1 * two);
25     ok = ok && (colorGreen.g * -1 == -colorGreen.g);
26     ok = ok && (-colorGreen == -1 * colorGreen);
27     return ok;
28 }
29
30 bool test_ivec() {
31     int one = 1;
32     const int two = 2;
33     const int4 one_splat = int4(1);
34     const int4 one_compound = int4(1, 1, 1, 1);
35
36     bool ok = true;
37     ok = ok && (int4(-1) == -one_splat);
38     ok = ok && (int4(-1, -1, -1, -1) == -one_splat);
39     ok = ok && (int4(-1) == -one_compound);
40     ok = ok && (int4(-1, -1, -1, -1) == -one_compound);
41     ok = ok && (-int4(1) == -one_splat);
42     ok = ok && (-int4(1, 1, 1, 1) == -one_splat);
43     ok = ok && (-int4(1) == -one_compound);
44     ok = ok && (-int4(1, 1, 1, 1) == -one_compound);
45     ok = ok && (int4(-1) == -int4(-int2(-1), int2(1)));
46     ok = ok && (int4(1) != -int4(1));
47     ok = ok && (-int4(two) == int4(-two, int3(-two)));
48     ok = ok && (-int2(-one, one + one) == -int2(one - two, two));
49     ok = ok && (-1 * one == -one);
50     ok = ok && (-two == -1 * two);
51     ok = ok && (-int(colorGreen.g) == -1 * int(colorGreen.g));
52     ok = ok && (int4(colorGreen) * -1 == -int4(colorGreen));
53     return ok;
54 }
55
56 bool test_mat() {
57     const float3x3 one_diagonal = float3x3(1);
58     const float3x3 one_compound = float3x3(1, 0, 0,
59                                            0, 1, 0,
60                                            0, 0, 1);
61     bool ok = true;
62     ok = ok && (float3x3(-1) == -one_diagonal);
63     ok = ok && (float3x3(-1, 0, 0, 0, -1, 0, 0, 0, -1) == -one_diagonal);
64     ok = ok && (float3x3(-1) == -one_compound);
65     ok = ok && (float3x3(-1, 0, 0, 0, -1, 0, 0, 0, -1) == -one_compound);
66     ok = ok && (-float3x3(1) == -one_diagonal);
67     ok = ok && (-float3x3(1, 0, 0, 0, 1, 0, 0, 0, 1) == -one_diagonal);
68     ok = ok && (-float3x3(1) == -one_compound);
69     ok = ok && (-float3x3(1, 0, 0, 0, 1, 0, 0, 0, 1) == -one_compound);
70     return ok;
71 }
72
73 half4 main(float2 coords) {
74     return test_fvec() && test_ivec() && test_mat() ? colorGreen : colorRed;
75 }