skia2/resources/sksl/shared/VectorToMatrixCast.sksl
John Stiles 5a825da698 Reland "Add tests for matrix-vector conversions."
This reverts commit f009db5b85.

Reason for revert: test disabled on Win10 + Intel 4400/6100

Original change's description:
> Revert "Add tests for matrix-vector conversions."
>
> This reverts commit a89781215a.
>
> 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 23:28:22 +00:00

19 lines
626 B
Plaintext

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);
return ok ? colorGreen : colorRed;
}