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