skia2/resources/sksl/shared/VectorToMatrixCast.sksl

29 lines
1.3 KiB
Plaintext
Raw Normal View History

Reland "Add tests for matrix-vector conversions." This reverts commit f009db5b854b350e9f884fd5268e80271537578b. Reason for revert: test disabled on Win10 + Intel 4400/6100 Original change's description: > Revert "Add tests for matrix-vector conversions." > > This reverts commit a89781215a8182beb0893a004654fef157313259. > > Reason for revert: breakage on Windows > > Original change's description: > > Add tests for matrix-vector conversions. > > > > GLSL supports casting vec4 into mat2 and vice versa, so SkSL should have > > equivalent support. Adding tests as a starting point. > > > > Change-Id: If8bcbf99afcec94d948d5da9e6205cb4a232af18 > > Bug: skia:12067 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425837 > > Auto-Submit: John Stiles <johnstiles@google.com> > > Commit-Queue: Brian Osman <brianosman@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I2563041f538b1b20074385f1b61af5fc506ffad5 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:12067 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426057 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> Bug: skia:12067 Change-Id: I1379914ee39ce340f09b11b3754820db9c645378 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426058 Reviewed-by: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-07-08 22:20:21 +00:00
uniform half4 colorGreen, colorRed;
uniform half4 testInputs;
half4 main(float2 coords) {
bool ok = true;
const half4 vec1234 = half4(1, 2, 3, 4);
ok = ok && half2x2(testInputs) == half2x2(-1.25, 0, 0.75, 2.25);
ok = ok && half2x2(half4(1, 2, 3, 4)) == half2x2(1, 2, 3, 4);
ok = ok && half2x2(vec1234) == half2x2(1, 2, 3, 4);
ok = ok && float2x2(testInputs) == float2x2(-1.25, 0, 0.75, 2.25);
ok = ok && float2x2(half4(1, 2, 3, 4)) == float2x2(1, 2, 3, 4);
ok = ok && float2x2(vec1234) == float2x2(1, 2, 3, 4);
ok = ok && half2x2(colorGreen) == half2x2(0, 1, 0, 1);
ok = ok && half2x2(colorGreen) == half2x2(int4(0, 1, 0, 1));
ok = ok && half2x2(int4(colorGreen)) == half2x2(int4(0, 1, 0, 1));
ok = ok && half2x2(0, 1, 0, 1) == half2x2(int4(0, 1, 0, 1));
ok = ok && half2x2(colorGreen) == half2x2(false, true, false, true);
ok = ok && half2x2(colorGreen) == half2x2(bool4(false, true, false, true));
ok = ok && half2x2(bool4(colorGreen)) == half2x2(bool4(false, true, false, true));
ok = ok && half2x2(false, true, false, true) == half2x2(bool4(false, true, false, true));
Reland "Add tests for matrix-vector conversions." This reverts commit f009db5b854b350e9f884fd5268e80271537578b. Reason for revert: test disabled on Win10 + Intel 4400/6100 Original change's description: > Revert "Add tests for matrix-vector conversions." > > This reverts commit a89781215a8182beb0893a004654fef157313259. > > Reason for revert: breakage on Windows > > Original change's description: > > Add tests for matrix-vector conversions. > > > > GLSL supports casting vec4 into mat2 and vice versa, so SkSL should have > > equivalent support. Adding tests as a starting point. > > > > Change-Id: If8bcbf99afcec94d948d5da9e6205cb4a232af18 > > Bug: skia:12067 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425837 > > Auto-Submit: John Stiles <johnstiles@google.com> > > Commit-Queue: Brian Osman <brianosman@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I2563041f538b1b20074385f1b61af5fc506ffad5 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:12067 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426057 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> Bug: skia:12067 Change-Id: I1379914ee39ce340f09b11b3754820db9c645378 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/426058 Reviewed-by: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-07-08 22:20:21 +00:00
return ok ? colorGreen : colorRed;
}