skia2/tests/sksl/shared/VectorToMatrixCast.glsl
John Stiles 49c417621b Shore up matrix/vector conversion tests.
The tests now check bool4-mat2 conversions, which fortunately do work,
and the vector-to-matrix tests include int and bool conversions as well.

Change-Id: I971271838a93081b9258deb7c1d13b7732fb2440
Bug: skia:12067
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426757
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-07-12 15:02:51 +00:00

18 lines
694 B
GLSL

out vec4 sk_FragColor;
uniform vec4 colorGreen;
uniform vec4 colorRed;
uniform vec4 testInputs;
vec4 main() {
bool ok = true;
ok = ok && mat2(testInputs) == mat2(-1.25, 0.0, 0.75, 2.25);
ok = ok && mat2(testInputs) == mat2(-1.25, 0.0, 0.75, 2.25);
ok = ok && mat2(colorGreen) == mat2(0.0, 1.0, 0.0, 1.0);
ok = ok && mat2(colorGreen) == mat2(0.0, 1.0, 0.0, 1.0);
ok = ok && mat2(vec4(ivec4(colorGreen))) == mat2(0.0, 1.0, 0.0, 1.0);
ok = ok && mat2(colorGreen) == mat2(0.0, 1.0, 0.0, 1.0);
ok = ok && mat2(colorGreen) == mat2(0.0, 1.0, 0.0, 1.0);
ok = ok && mat2(vec4(bvec4(colorGreen))) == mat2(0.0, 1.0, 0.0, 1.0);
return ok ? colorGreen : colorRed;
}