xref: /aosp_15_r20/external/skia/resources/sksl/intrinsics/Dot.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1uniform float4x4 testMatrix4x4;  // = {1, 2, 3, 4, 5, 6, 7, 8, ...}
2uniform half4 colorGreen, colorRed;
3
4half4 main(float2 coords) {
5    const float4 constValA = half4(1, 2, 3, 4);
6    const float4 constValB = half4(5, 6, 7, 8);
7    float4 inputA = float4(testMatrix4x4[0]);
8    float4 inputB = float4(testMatrix4x4[1]);
9    float4 expected = float4(5, 17, 38, 70);
10
11    return (dot(inputA.x,       inputB.x)       == expected.x &&
12            dot(inputA.xy,      inputB.xy)      == expected.y &&
13            dot(inputA.xyz,     inputB.xyz)     == expected.z &&
14            dot(inputA.xyzw,    inputB.xyzw)    == expected.w &&
15            dot(constValA.x,    constValB.x)    == expected.x &&
16            dot(constValA.xy,   constValB.xy)   == expected.y &&
17            dot(constValA.xyz,  constValB.xyz)  == expected.z &&
18            dot(constValA.xyzw, constValB.xyzw) == expected.w) ? colorGreen : colorRed;
19}
20