xref: /aosp_15_r20/external/skia/resources/sksl/shared/SwizzleIndexStore.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1uniform half4 colorGreen, colorRed;
2uniform float3x3 testMatrix3x3;
3uniform float4x4 testMatrix4x4;
4
5bool test3x3() {
6    float3 expected = float3(3, 2, 1);
7    float3 vec;
8    for (int c=0; c<3; ++c) {
9        for (int r=0; r<3; ++r) {
10            vec.zyx[r] = testMatrix3x3[c][r];
11        }
12        if (vec != expected) {
13            return false;
14        }
15        expected += 3;
16    }
17    return true;
18}
19
20bool test4x4() {
21    float4 expected = float4(4, 3, 2, 1);
22    float4 vec;
23    for (int c=0; c<4; ++c) {
24        for (int r=0; r<4; ++r) {
25            vec.wzyx[r] = testMatrix4x4[c][r];
26        }
27        if (vec != expected) {
28            return false;
29        }
30        expected += 4;
31    }
32    return true;
33}
34
35half4 main(float2 coords) {
36    return test3x3() && test4x4() ? colorGreen : colorRed;
37}
38