1uniform half4 colorGreen, colorRed; 2 3half4 main(float2 coords) { 4 float4 value = float4(2.5, -2.5, 8, -0.125); 5 const float4 expectedWhole = float4(2, -2, 8, 0); 6 const float4 expectedFraction = float4(0.5, -0.5, 0, -0.125); 7 bool4 ok = bool4(false); 8 float4 whole, fraction; 9 10 fraction.x = modf(value.x, whole.x); 11 ok.x = whole.x == expectedWhole.x && fraction.x == expectedFraction.x; 12 fraction.xy = modf(value.xy, whole.xy); 13 ok.y = whole.xy == expectedWhole.xy && fraction.xy == expectedFraction.xy; 14 fraction.xyz = modf(value.xyz, whole.xyz); 15 ok.z = whole.xyz == expectedWhole.xyz && fraction.xyz == expectedFraction.xyz; 16 fraction.xyzw = modf(value.xyzw, whole.xyzw); 17 ok.w = whole.xyzw == expectedWhole.xyzw && fraction.xyzw == expectedFraction.xyzw; 18 19 return all(ok) ? colorGreen : colorRed; 20} 21