xref: /aosp_15_r20/external/skia/resources/sksl/shared/MatrixSwizzleStore.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1uniform half4 colorGreen, colorRed;
2uniform float3x3 testMatrix3x3;
3uniform float4x4 testMatrix4x4;
4
5bool test3x3() {
6    float3x3 matrix;
7    float3 values = float3(3, 2, 1);
8    for (int index=0; index<3; ++index) {
9        matrix[index].zx = values.xz;
10        matrix[index].y = values.y;
11        values += 3;
12    }
13    return matrix == testMatrix3x3;
14}
15
16bool test4x4() {
17    float4x4 matrix;
18    float4 values = float4(4, 3, 2, 1);
19    for (int index=0; index<4; ++index) {
20        matrix[index].wx = values.xw;
21        matrix[index].zy = values.yz;
22        values += 4;
23    }
24    return matrix == testMatrix4x4;
25}
26
27half4 main(float2 coords) {
28    return test3x3() && test4x4() ? colorGreen : colorRed;
29}
30