• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1uniform half4 testInputs;
2uniform half4 colorGreen, colorRed;
3
4half4 main(float2 coords) {
5    half4 expectedA = half4(-1,     0,  0.75, 1);
6
7    //                     (-1.25,  0,  0.75, 2.25)
8
9    half4 clampLow  = half4(-1,    -2, -2,    1);
10    half4 expectedB = half4(-1,     0,  0.5,  2.25);
11    half4 clampHigh = half4( 1,     2,  0.5,  3);
12
13    return (clamp(testInputs.x,    -1, 1)                         == expectedA.x     &&
14            clamp(testInputs.xy,   -1, 1)                         == expectedA.xy    &&
15            clamp(testInputs.xyz,  -1, 1)                         == expectedA.xyz   &&
16            clamp(testInputs.xyzw, -1, 1)                         == expectedA.xyzw  &&
17            clamp(testInputs.x,    clampLow.x,    clampHigh.x   ) == expectedB.x     &&
18            clamp(testInputs.xy,   clampLow.xy,   clampHigh.xy  ) == expectedB.xy    &&
19            clamp(testInputs.xyz,  clampLow.xyz,  clampHigh.xyz ) == expectedB.xyz   &&
20            clamp(testInputs.xyzw, clampLow.xyzw, clampHigh.xyzw) == expectedB.xyzw) ? colorGreen
21                                                                                     : colorRed;
22}
23