uniform half4 colorGreen, colorRed; | |
half4 main(float2 coords) { | |
float4 value = colorGreen.gggg * 6; | |
int4 exp; | |
float4 result; | |
bool4 ok; | |
// 6 equals 0.75 * 2^3. | |
result.x = frexp(value.x, exp.x); | |
ok.x = (result.x == 0.75 && exp.x == 3); | |
result.xy = frexp(value.xy, exp.xy); | |
ok.y = (result.y == 0.75 && exp.y == 3); | |
result.xyz = frexp(value.xyz, exp.xyz); | |
ok.z = (result.z == 0.75 && exp.z == 3); | |
result.xyzw = frexp(value.xyzw, exp.xyzw); | |
ok.w = (result.w == 0.75 && exp.w == 3); | |
return all(ok) ? colorGreen : colorRed; | |
} |