1uniform half4 colorGreen, colorRed, colorBlack, colorWhite, testInputs; 2 3// This test covers mix(vec, vec, vec) and mix(vec, vec, scalar). 4// See MixFloatES3 and MixBool for additional forms of mix. 5 6half4 main(float2 coords) { 7 const half4 constBlack = half4(0, 0, 0, 1); 8 const half4 constWhite = half4(1); 9 const half4 constVal = half4(-1.25, 0, 0.75, 2.25); 10 half4 expectedBW = half4(0.5, 0.5, 0.5, 1); 11 half4 expectedWT = half4(1, 0.5, 1, 2.25); 12 13 return (mix(colorGreen, colorRed, 0) == half4(0, 1, 0, 1) && 14 mix(colorGreen, colorRed, 0.25) == half4(0.25, 0.75, 0, 1) && 15 mix(colorGreen, colorRed, 0.75) == half4(0.75, 0.25, 0, 1) && 16 mix(colorGreen, colorRed, 1) == half4(1, 0, 0, 1) && 17 mix(colorBlack.x, colorWhite.x, 0.5) == expectedBW.x && 18 mix(colorBlack.xy, colorWhite.xy, 0.5) == expectedBW.xy && 19 mix(colorBlack.xyz, colorWhite.xyz, 0.5) == expectedBW.xyz && 20 mix(colorBlack.xyzw, colorWhite.xyzw, 0.5) == expectedBW.xyzw && 21 mix(constBlack.x, constWhite.x, 0.5) == expectedBW.x && 22 mix(constBlack.xy, constWhite.xy, 0.5) == expectedBW.xy && 23 mix(constBlack.xyz, constWhite.xyz, 0.5) == expectedBW.xyz && 24 mix(constBlack.xyzw, constWhite.xyzw, 0.5) == expectedBW.xyzw && 25 mix(colorWhite.x, testInputs.x, 0) == expectedWT.x && 26 mix(colorWhite.xy, testInputs.xy, half2(0, 0.5)) == expectedWT.xy && 27 mix(colorWhite.xyz, testInputs.xyz, half3(0, 0.5, 0)) == expectedWT.xyz && 28 mix(colorWhite.xyzw, testInputs.xyzw, half4(0, 0.5, 0, 1)) == expectedWT.xyzw && 29 mix(constWhite.x, constVal.x, 0) == expectedWT.x && 30 mix(constWhite.xy, constVal.xy, half2(0, 0.5)) == expectedWT.xy && 31 mix(constWhite.xyz, constVal.xyz, half3(0, 0.5, 0)) == expectedWT.xyz && 32 mix(constWhite.xyzw, constVal.xyzw, half4(0, 0.5, 0, 1)) == expectedWT.xyzw) 33 ? colorGreen : colorRed; 34} 35