skia2/tests/sksl/intrinsics/Fwidth.glsl
John Stiles 25868511fd Add fwidth intrinsic to public SkSL in ES3.
Change-Id: Icd55cc62db41ba6c7008161512e5584927f21757
Bug: skia:12202
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449190
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-09-16 01:56:32 +00:00

10 lines
579 B
GLSL

out vec4 sk_FragColor;
uniform vec4 testInputs;
uniform vec4 colorGreen;
uniform vec4 colorRed;
vec4 main() {
vec4 expected = vec4(0.0);
return (((((((dFdx(testInputs.x) == expected.x && dFdx(testInputs.xy) == expected.xy) && dFdx(testInputs.xyz) == expected.xyz) && dFdx(testInputs) == expected) && sign(fwidth(coords.xx)) == vec2(1.0, 1.0)) && sign(fwidth(vec2(coords.x, 1.0))) == vec2(1.0, 0.0)) && sign(fwidth(coords.yy)) == vec2(1.0, 1.0)) && sign(fwidth(vec2(0.0, coords.y))) == vec2(0.0, 1.0)) && sign(fwidth(coords)) == vec2(1.0, 1.0) ? colorGreen : colorRed;
}