1uniform half4 colorGreen, colorRed; 2uniform float4 testInputs; // equals (-1.25, 0, 0.75, 2.25) 3 4half4 main(float2 coords) { 5 const float4 constVal = float4(-1.25, 0, 0.75, 2.25); 6 const float4 expected = clamp(constVal, 0, 1); 7 const uint constXY = packUnorm2x16(constVal.xy); 8 const uint constZW = packUnorm2x16(constVal.zw); 9 uint xy = packUnorm2x16(testInputs.xy); 10 uint zw = packUnorm2x16(testInputs.zw); 11 const float2 tolerance = float2(0.015625); 12 13 return (all(lessThan(abs(unpackUnorm2x16(xy) - float2(expected.xy)), tolerance)) && 14 all(lessThan(abs(unpackUnorm2x16(zw) - float2(expected.zw)), tolerance)) && 15 all(lessThan(abs(unpackUnorm2x16(constXY) - float2(expected.xy)), tolerance)) && 16 all(lessThan(abs(unpackUnorm2x16(constZW) - float2(expected.zw)), tolerance))) 17 ? colorGreen : colorRed; 18} 19