skia2/tests/sksl/shared/ArrayComparison.glsl
John Stiles 3509210622 Implement array == and != on SPIR-V.
GLSL (post-ES2) allows array comparison: http://screen/8gryPvb9T7gndyb

Unfortunately, because ES2 does not support array comparisons, we can't
add this test to the dm test suite.

Change-Id: I06b71683e49b2631669cff801dc647951a81a299
Bug: skia:11849
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/394162
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-04-09 15:33:57 +00:00

18 lines
495 B
GLSL

out vec4 sk_FragColor;
uniform vec4 colorGreen;
uniform vec4 colorRed;
struct S {
int x;
int y;
};
vec4 main() {
float f1[4] = float[4](1.0, 2.0, 3.0, 4.0);
float f2[4] = float[4](1.0, 2.0, 3.0, 4.0);
float f3[4] = float[4](1.0, 2.0, 3.0, -4.0);
S s1[3] = S[3](S(1, 2), S(3, 4), S(5, 6));
S s2[3] = S[3](S(1, 2), S(0, 0), S(5, 6));
S s3[3] = S[3](S(1, 2), S(3, 4), S(5, 6));
return ((f1 == f2 && f1 != f3) && s1 != s2) && s3 == s1 ? colorGreen : colorRed;
}