1uniform half4 colorGreen, colorRed; 2 3half4 main(float2 coords) { 4 float4 value = colorGreen.gggg * 6; 5 int4 exp; 6 float4 result; 7 bool4 ok; 8 9 // 6 equals 0.75 * 2^3. 10 result.x = frexp(value.x, exp.x); 11 ok.x = (result.x == 0.75 && exp.x == 3); 12 result.xy = frexp(value.xy, exp.xy); 13 ok.y = (result.y == 0.75 && exp.y == 3); 14 result.xyz = frexp(value.xyz, exp.xyz); 15 ok.z = (result.z == 0.75 && exp.z == 3); 16 result.xyzw = frexp(value.xyzw, exp.xyzw); 17 ok.w = (result.w == 0.75 && exp.w == 3); 18 19 return all(ok) ? colorGreen : colorRed; 20} 21