• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1uniform half4 colorGreen, colorRed;
2uniform float2x2 testMatrix2x2;
3uniform float3x3 testMatrix3x3;
4uniform half4 testInputs;  // equals (-1.25, 0, 0.75, 2.25)
5
6half4 main(float2 coords) {
7    const float2 c12  = float2(1, 2);
8    const float2 c34  = float2(3, 4);
9    const float3 c123 = float3(1, 2, 3);
10    const float3 c456 = float3(4, 5, 6);
11
12    return  (outerProduct(testMatrix2x2[0], testMatrix2x2[1]) == float2x2(3, 6,
13                                                                          4, 8)
14          && outerProduct(c12, c34)                           == float2x2(3, 6,
15                                                                          4, 8)
16          && outerProduct(testMatrix3x3[0], testMatrix3x3[1]) == float3x3(4, 8,  12,
17                                                                          5, 10, 15,
18                                                                          6, 12, 18)
19          && outerProduct(c123, c456)                         == float3x3(4, 8,  12,
20                                                                          5, 10, 15,
21                                                                          6, 12, 18)
22          && outerProduct(testMatrix2x2[0], testMatrix3x3[1]) == float3x2(4, 8,
23                                                                          5, 10,
24                                                                          6, 12)
25          && outerProduct(c12, c456)                          == float3x2(4, 8,
26                                                                          5, 10,
27                                                                          6, 12)
28          && outerProduct(testInputs, half4(1, 0, 0, 2))      == float4x4(-1.25, 0.0, 0.75, 2.25,
29                                                                           0.0,  0.0, 0.0,  0.0,
30                                                                           0.0,  0.0, 0.0,  0.0,
31                                                                          -2.50, 0.0, 1.50, 4.50)
32          && outerProduct(half4(-1.25, 0, 0.75, 2.25), half4(1, 0, 0, 2))
33                                                              == float4x4(-1.25, 0.0, 0.75, 2.25,
34                                                                           0.0,  0.0, 0.0,  0.0,
35                                                                           0.0,  0.0, 0.0,  0.0,
36                                                                          -2.50, 0.0, 1.50, 4.50)
37          && outerProduct(testInputs, c12)                    == float2x4(-1.25, 0.0, 0.75, 2.25,
38                                                                          -2.50, 0.0, 1.50, 4.50)
39          && outerProduct(c12, testInputs)                    == float4x2(-1.25, -2.50,
40                                                                           0.0,   0.0,
41                                                                           0.75,  1.50,
42                                                                           2.25,  4.50))
43           ? colorGreen : colorRed;
44}
45