xref: /aosp_15_r20/external/skia/resources/sksl/intrinsics/FloatBitsToInt.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 int4 expectedA = int4(-0x40800000, 0x00000000, 0x3F800000, 0x40000000);
7
8    float4 inputVal = float4(testMatrix2x2) * float4(1, 1, -1, -1);
9    const int4 expectedB = int4(0x3F800000, 0x40000000, -0x3FC00000, -0x3F800000);
10
11    return (floatBitsToInt(constVal.x)    == expectedA.x    &&
12            floatBitsToInt(constVal.xy)   == expectedA.xy   &&
13            floatBitsToInt(constVal.xyz)  == expectedA.xyz  &&
14            floatBitsToInt(constVal.xyzw) == expectedA.xyzw &&
15            floatBitsToInt(inputVal.x)    == expectedB.x    &&
16            floatBitsToInt(inputVal.xy)   == expectedB.xy   &&
17            floatBitsToInt(inputVal.xyz)  == expectedB.xyz  &&
18            floatBitsToInt(inputVal.xyzw) == expectedB.xyzw) ? colorGreen : colorRed;
19}
20