skia2/tests/sksl/intrinsics/DFdy.glsl
John Stiles a143a37747 Wrap 'u_rtFlip.y * dfdy()' in parentheses, in GLSL.
This guards against unexpected results when dfdy is used in complex
expressions. In practice, I'm not aware of this causing any trouble.

Change-Id: Ia476e57936969d248273856a94d5c403b47c29b4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465379
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-10-29 14:03:35 +00:00

11 lines
603 B
GLSL

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