skia2/resources/sksl/shared/MatrixScalarSplat.sksl
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

38 lines
1.3 KiB
Plaintext

uniform half4 colorGreen, colorRed;
bool test_float() {
bool ok = true;
ok = ok && ((float3x3(2) + 4) == float3x3(6, 4, 4, 4, 6, 4, 4, 4, 6));
ok = ok && ((float3x3(2) - 4) == float3x3(-2, -4, -4, -4, -2, -4, -4, -4, -2));
ok = ok && ((float3x3(2) * 4) == float3x3(8));
ok = ok && ((float3x3(2) / 4) == float3x3(0.5));
ok = ok && (4 + (float3x3(2)) == float3x3(6, 4, 4, 4, 6, 4, 4, 4, 6));
ok = ok && (4 - (float3x3(2)) == float3x3(2, 4, 4, 4, 2, 4, 4, 4, 2));
ok = ok && (4 * (float3x3(2)) == float3x3(8));
ok = ok && (4 / (float2x2(2, 2, 2, 2)) == float2x2(2, 2, 2, 2));
return ok;
}
bool test_half() {
bool ok = true;
ok = ok && ((half3x3(2) + 4) == half3x3(6, 4, 4, 4, 6, 4, 4, 4, 6));
ok = ok && ((half3x3(2) - 4) == half3x3(-2, -4, -4, -4, -2, -4, -4, -4, -2));
ok = ok && ((half3x3(2) * 4) == half3x3(8));
ok = ok && ((half3x3(2) / 4) == half3x3(0.5));
ok = ok && (4 + (half3x3(2)) == half3x3(6, 4, 4, 4, 6, 4, 4, 4, 6));
ok = ok && (4 - (half3x3(2)) == half3x3(2, 4, 4, 4, 2, 4, 4, 4, 2));
ok = ok && (4 * (half3x3(2)) == half3x3(8));
ok = ok && (4 / (half2x2(2, 2, 2, 2)) == half2x2(2, 2, 2, 2));
return ok;
}
half4 main(float2 coords) {
return test_float() && test_half() ? colorGreen : colorRed;
}