• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1uniform half4 colorWhite, colorGreen, colorRed;
2uniform float2x2 testMatrix2x2;
3uniform float3x3 testMatrix3x3;
4uniform float4x4 testMatrix4x4;
5
6bool test_fscalar() {
7    float x = colorWhite.r;
8    x = +x;
9    x = -x;
10    return x == -1;
11}
12
13bool test_iscalar() {
14    int x = int(colorWhite.r);
15    x = +x;
16    x = -x;
17    return x == -1;
18}
19
20bool test_fvec() {
21    half2 x = colorWhite.rg;
22    x = +x;
23    x = -x;
24    return x == half2(-1);
25}
26
27bool test_ivec() {
28    int2 x = int2(colorWhite.r);
29    x = +x;
30    x = -x;
31    return x == int2(-1);
32}
33
34bool test_mat2() {
35    const float2x2 negated = float2x2(-1, -2,
36                                      -3, -4);
37    float2x2 x = testMatrix2x2;
38    x = +x;
39    x = -x;
40    return x == negated;
41}
42
43bool test_mat3() {
44    const float3x3 negated = float3x3(-1, -2, -3,
45                                      -4, -5, -6,
46                                      -7, -8, -9);
47    float3x3 x = testMatrix3x3;
48    x = +x;
49    x = -x;
50    return x == negated;
51}
52
53bool test_mat4() {
54    const float4x4 negated = float4x4(-1,  -2,  -3,  -4,
55                                      -5,  -6,  -7,  -8,
56                                      -9,  -10, -11, -12,
57                                      -13, -14, -15, -16);
58    float4x4 x = testMatrix4x4;
59    x = +x;
60    x = -x;
61    return x == negated;
62}
63
64half4 main(float2 coords) {
65    return test_fscalar()
66            && test_iscalar()
67            && test_fvec()
68            && test_ivec()
69            && test_mat2()
70            && test_mat3()
71            && test_mat4() ? colorGreen : colorRed;
72}
73