xref: /aosp_15_r20/external/skia/resources/sksl/intrinsics/FloatBitsToUint.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1uniform float2x2 testMatrix2x2;
2uniform half4 colorGreen, colorRed;
3
4half4 main(float2 coords) {
5    const float4 constVal = float4(-1, 0, 1, 2);
6    const uint4 expectedA = uint4(0xBF800000, 0x00000000, 0x3F800000, 0x40000000);
7
8    float4 inputVal = float4(testMatrix2x2) * float4(1, 1, -1, -1);
9    const uint4 expectedB = uint4(0x3F800000, 0x40000000, 0xC0400000, 0xC0800000);
10
11    return (floatBitsToUint(constVal.x)    == expectedA.x    &&
12            floatBitsToUint(constVal.xy)   == expectedA.xy   &&
13            floatBitsToUint(constVal.xyz)  == expectedA.xyz  &&
14            floatBitsToUint(constVal.xyzw) == expectedA.xyzw &&
15            floatBitsToUint(inputVal.x)    == expectedB.x    &&
16            floatBitsToUint(inputVal.xy)   == expectedB.xy   &&
17            floatBitsToUint(inputVal.xyz)  == expectedB.xyz  &&
18            floatBitsToUint(inputVal.xyzw) == expectedB.xyzw) ? colorGreen : colorRed;
19}
20