skia2/tests/sksl/shared/CommaSideEffects.glsl
John Stiles 94e72b90b8 Add test to verify side effects from the comma operator.
SkVMCodeGenerator was lacking support for the comma operator entirely;
this has now been implemented.

Change-Id: I9350f54e6ee52764c620116e6dbfe4ca3e9cd47e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363096
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-01 16:16:58 +00:00

24 lines
483 B
GLSL

out vec4 sk_FragColor;
uniform vec4 colorRed;
uniform vec4 colorGreen;
uniform vec4 colorWhite;
uniform vec4 colorBlack;
void setToColorBlack(out vec4 x) {
x = colorBlack;
}
vec4 main() {
vec4 a;
vec4 b;
vec4 c;
vec4 d;
(b = colorRed , c = colorGreen);
a = (setToColorBlack(d) , colorWhite);
a *= a;
b *= b;
c *= c;
d *= d;
return ((a == colorWhite && b == colorRed) && c == colorGreen) && d == colorBlack ? colorGreen : colorRed;
}