skia2/resources/sksl/intrinsics/DFdy.sksl
John Stiles 1fa2c28ee1 Fix dFdy test.
This was mistakenly using dFdx in some portions (copy-paste error).

Change-Id: Ifb159b3c44185d9166c10725b24002a28a0895b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/464381
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-27 21:25:32 +00:00

14 lines
600 B
Plaintext

uniform half4 testInputs; // equals (-1.25, 0, 0.75, 2.25)
uniform half4 colorGreen, colorRed;
half4 main(float2 coords) {
half4 expected = half4(0); // derivative of a constant is zero
return (dFdy(testInputs.x) == expected.x &&
dFdy(testInputs.xy) == expected.xy &&
dFdy(testInputs.xyz) == expected.xyz &&
dFdy(testInputs.xyzw) == expected.xyzw &&
sign(dFdy(coords.xx)) == half2(0, 0) &&
sign(dFdy(coords.yy)) == half2(1, 1) &&
sign(dFdy(coords.xy)) == half2(0, 1)) ? colorGreen : colorRed;
}