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