skia2/resources/sksl/shared/MatricesNonsquare.sksl
John Stiles 56233d1379 Migrate matrix SkSL test to dm.
This uncovered a bug in Metal code generation of `matX *= matY` which is
now fixed. (It was emitting the helper function more than once.)

Change-Id: I0aeb0efe7ab5fbf5592a8ca6f4f5b50354d3d7f4
Bug: skia:11262
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365489
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-02-03 20:42:57 +00:00

36 lines
834 B
Plaintext

uniform half4 colorGreen, colorRed;
bool test_float() {
float2x3 m23 = float2x3(23);
float2x4 m24 = float2x4(24);
float3x2 m32 = float3x2(32);
float3x4 m34 = float3x4(34);
float4x2 m42 = float4x2(42);
float4x3 m43 = float4x3(44);
float2x2 m22 = m32 * m23; m22 *= m22;
float3x3 m33 = m43 * m34; m33 *= m33;
float4x4 m44 = m24 * m42; m44 *= m44;
return true;
}
bool test_half() {
half2x3 m23 = half2x3(23);
half2x4 m24 = half2x4(24);
half3x2 m32 = half3x2(32);
half3x4 m34 = half3x4(34);
half4x2 m42 = half4x2(42);
half4x3 m43 = half4x3(44);
half2x2 m22 = m32 * m23; m22 *= m22;
half3x3 m33 = m43 * m34; m33 *= m33;
half4x4 m44 = m24 * m42; m44 *= m44;
return true;
}
half4 main() {
return test_float() && test_half() ? colorGreen : colorRed;
}