• 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(dFdx(coords.xx)) == half2(1, 1)    &&
11            sign(dFdx(coords.yy)) == half2(0, 0)    &&
12            sign(dFdx(coords.xy)) == half2(1, 0)) ? colorGreen : colorRed;
13}
14