• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1uniform half4 testInputs;  // equals (-1.25, 0, 0.75, 2.25)
2uniform half4 colorGreen, colorRed;
3
4half4 main(float2 coords) {
5    half4 expected = half4(0);  // derivative of a constant is zero
6    return (dFdx(testInputs.x)      == expected.x     &&
7            dFdx(testInputs.xy)     == expected.xy    &&
8            dFdx(testInputs.xyz)    == expected.xyz   &&
9            dFdx(testInputs.xyzw)   == expected.xyzw  &&
10            sign(fwidth(coords.xx)) == half2(1, 1)        &&
11            sign(fwidth(coords.x1)) == half2(1, 0)        &&
12            sign(fwidth(coords.yy)) == half2(1, 1)        &&
13            sign(fwidth(coords.0y)) == half2(0, 1)        &&
14            sign(fwidth(coords.xy)) == half2(1, 1)) ? colorGreen : colorRed;
15}
16