• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// We use bitwise ops below, which SkVM supports but ES2 technically does not.
2#version 300
3
4/*#pragma settings SkVMDebugTrace NoTraceVarInSkVMDebugTrace*/
5
6uniform half4 colorGreen, colorRed;
7uniform float2x2 testMatrix2x2;
8
9half4 main(float2 xy) {
10    bool ok = true;
11    int   a = int(testMatrix2x2[0][0]), b = int(testMatrix2x2[0][1]);
12    float c =    (testMatrix2x2[1][0]), d =    (testMatrix2x2[1][1]);
13
14    int a_and_b = a & b;
15    int b_and_a = b & a;
16    ok = ok && (a_and_b == b_and_a);
17
18    int a_or_b = a | b;
19    int b_or_a = b | a;
20    ok = ok && (a_or_b == b_or_a);
21
22    int a_xor_b = a ^ b;
23    int b_xor_a = b ^ a;
24    ok = ok && (a_xor_b == b_xor_a);
25
26    bool a_eq_b = a == b;
27    bool b_eq_a = b == a;
28    ok = ok && (a_eq_b == b_eq_a);
29
30    bool a_neq_b = a != b;
31    bool b_neq_a = b != a;
32    ok = ok && (a_neq_b == b_neq_a);
33
34    int a_add_b = a + b;
35    int b_add_a = b + a;
36    ok = ok && (a_add_b == b_add_a);
37
38    float c_add_d = c + d;
39    float d_add_c = d + c;
40    ok = ok && (c_add_d == d_add_c);
41
42    int a_mul_b = a * b;
43    int b_mul_a = b * a;
44    ok = ok && (a_mul_b == b_mul_a);
45
46    float c_mul_d = c * d;
47    float d_mul_c = d * c;
48    ok = ok && (c_mul_d == d_mul_c);
49
50    return ok ? colorGreen : colorRed;
51}
52