skia2/tests/sksl/shared/MatrixScalarSplat.glsl
John Stiles 191b4e2a00 Enable proper testing of matrix-scalar ops.
Now that the various Metal and SPIR-V bugs have been shaken out, we can
enable these tests. Knock on wood.

Change-Id: If4b4e302cfdd91464aaf00bc9639989de5e49aac
Bug: skia:11985
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408640
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-05-17 17:36:22 +00:00

29 lines
1.4 KiB
GLSL

out vec4 sk_FragColor;
uniform vec4 colorGreen;
uniform vec4 colorRed;
bool test_half_b() {
bool ok = true;
ok = ok && mat3(2.0) + 4.0 == mat3(6.0, 4.0, 4.0, 4.0, 6.0, 4.0, 4.0, 4.0, 6.0);
ok = ok && mat3(2.0) - 4.0 == mat3(-2.0, -4.0, -4.0, -4.0, -2.0, -4.0, -4.0, -4.0, -2.0);
ok = ok && mat3(2.0) * 4.0 == mat3(8.0);
ok = ok && mat3(2.0) / 4.0 == mat3(0.5);
ok = ok && 4.0 + mat3(2.0) == mat3(6.0, 4.0, 4.0, 4.0, 6.0, 4.0, 4.0, 4.0, 6.0);
ok = ok && 4.0 - mat3(2.0) == mat3(2.0, 4.0, 4.0, 4.0, 2.0, 4.0, 4.0, 4.0, 2.0);
ok = ok && 4.0 * mat3(2.0) == mat3(8.0);
ok = ok && 4.0 / mat2(2.0, 2.0, 2.0, 2.0) == mat2(2.0, 2.0, 2.0, 2.0);
return ok;
}
vec4 main() {
bool _0_ok = true;
_0_ok = _0_ok && mat3(2.0) + 4.0 == mat3(6.0, 4.0, 4.0, 4.0, 6.0, 4.0, 4.0, 4.0, 6.0);
_0_ok = _0_ok && mat3(2.0) - 4.0 == mat3(-2.0, -4.0, -4.0, -4.0, -2.0, -4.0, -4.0, -4.0, -2.0);
_0_ok = _0_ok && mat3(2.0) * 4.0 == mat3(8.0);
_0_ok = _0_ok && mat3(2.0) / 4.0 == mat3(0.5);
_0_ok = _0_ok && 4.0 + mat3(2.0) == mat3(6.0, 4.0, 4.0, 4.0, 6.0, 4.0, 4.0, 4.0, 6.0);
_0_ok = _0_ok && 4.0 - mat3(2.0) == mat3(2.0, 4.0, 4.0, 4.0, 2.0, 4.0, 4.0, 4.0, 2.0);
_0_ok = _0_ok && 4.0 * mat3(2.0) == mat3(8.0);
_0_ok = _0_ok && 4.0 / mat2(2.0, 2.0, 2.0, 2.0) == mat2(2.0, 2.0, 2.0, 2.0);
return _0_ok && test_half_b() ? colorGreen : colorRed;
}