skia2/resources/sksl/shared/MatricesNonsquare.sksl
John Stiles ab3e6394a0 Re-enable the nonsquare matrix test.
The mat4x2 portion of the test no longer checks its results, as there
are bugs in the Intel and Radeon GPU drivers that prevent mat4x2s
from being constructed properly.

The SkSL optimizer ends up eliminating the 4x2 matrix entirely because
it is unused by the rest of the code, as well at the 4x4 matrix which is
calculated from the 4x2. At this point, I'm OK with this.

Change-Id: If1464f9e4938b0a37b2ec180c686972389d94e83
Bug: skia:12003
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408900
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-05-17 13:27:48 +00:00

78 lines
2.6 KiB
Plaintext

uniform half4 colorGreen, colorRed;
bool test_float() {
bool ok = true;
float2x3 m23 = float2x3(2);
ok = ok && (m23 == float2x3(2, 0, 0,
0, 2, 0));
float2x4 m24 = float2x4(3);
ok = ok && (m24 == float2x4(3, 0, 0, 0,
0, 3, 0, 0));
float3x2 m32 = float3x2(4);
ok = ok && (m32 == float3x2(4, 0,
0, 4,
0, 0));
float3x4 m34 = float3x4(5);
ok = ok && (m34 == float3x4(5, 0, 0, 0,
0, 5, 0, 0,
0, 0, 5, 0));
float4x2 m42 = float4x2(6);
// Some Intel and Radeon GLSL drivers don't assemble the mat4x2 properly. (skia:12003)
// ok = ok && (m42 == float4x2(6, 0,
// 0, 6,
// 0, 0,
// 0, 0));
float4x3 m43 = float4x3(7);
ok = ok && (m43 == float4x3(7, 0, 0,
0, 7, 0,
0, 0, 7,
0, 0, 0));
float2x2 m22 = m32 * m23;
ok = ok && (m22 == float2x2(2 * 4));
float3x3 m33 = m43 * m34;
ok = ok && (m33 == float3x3(7 * 5));
float4x4 m44 = m24 * m42;
return ok;
}
bool test_half() {
bool ok = true;
half2x3 m23 = half2x3(2);
ok = ok && (m23 == half2x3(2, 0, 0,
0, 2, 0));
half2x4 m24 = half2x4(3);
ok = ok && (m24 == half2x4(3, 0, 0, 0,
0, 3, 0, 0));
half3x2 m32 = half3x2(4);
ok = ok && (m32 == half3x2(4, 0,
0, 4,
0, 0));
half3x4 m34 = half3x4(5);
ok = ok && (m34 == half3x4(5, 0, 0, 0,
0, 5, 0, 0,
0, 0, 5, 0));
half4x2 m42 = half4x2(6);
// Some Intel and Radeon GLSL drivers don't assemble the mat4x2 properly. (skia:12003)
// ok = ok && (m42 == half4x2(6, 0,
// 0, 6,
// 0, 0,
// 0, 0));
half4x3 m43 = half4x3(7);
ok = ok && (m43 == half4x3(7, 0, 0,
0, 7, 0,
0, 0, 7,
0, 0, 0));
half2x2 m22 = m32 * m23;
ok = ok && (m22 == half2x2(2 * 4));
half3x3 m33 = m43 * m34;
ok = ok && (m33 == half3x3(7 * 5));
half4x4 m44 = m24 * m42;
return ok;
}
half4 main(float2 coords) {
return test_float() && test_half() ? colorGreen : colorRed;
}