skia2/resources/sksl/shared/MatrixToVectorCast.sksl

36 lines
1.5 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 half2x2 testMatrix2x2;
half4 main(float2 coords) {
const half2x2 mat1234 = half2x2(1, 2, 3, 4);
const half2x2 bmat1234 = half2x2(1, 0, 1, 0);
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
bool ok = true;
ok = ok && half4(testMatrix2x2) == half4(1, 2, 3, 4);
ok = ok && half4(half2x2(1, 2, 3, 4)) == half4(1, 2, 3, 4);
ok = ok && half4(mat1234) == half4(1, 2, 3, 4);
ok = ok && half4(half2x2(2)) == half4(2, 0, 0, 2);
ok = ok && half4(half2x2(2, 2, 2, 2)) == half4(2);
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
ok = ok && float4(testMatrix2x2) == float4(1, 2, 3, 4);
ok = ok && float4(half2x2(1, 2, 3, 4)) == float4(1, 2, 3, 4);
ok = ok && float4(mat1234) == float4(1, 2, 3, 4);
ok = ok && float4(float2x2(4)) == float4(4, 0, 0, 4);
ok = ok && float4(float2x2(2, 2, 2, 2)) == float4(2);
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
ok = ok && int4(testMatrix2x2) == int4(1, 2, 3, 4);
ok = ok && int4(half2x2(1, 2, 3, 4)) == int4(1, 2, 3, 4);
ok = ok && int4(mat1234) == int4(1, 2, 3, 4);
ok = ok && int4(float2x2(8)) == int4(8, 0, 0, 8);
ok = ok && int4(float2x2(8, 8, 8, 8)) == int4(8);
ok = ok && bool4(testMatrix2x2) == bool4(true, true, true, true);
ok = ok && bool4(half2x2(0, 1, 0, 1)) == bool4(false, true, false, true);
ok = ok && bool4(bmat1234) == bool4(true, false, true, false);
ok = ok && bool4(half2x2(1)) == bool4(true, false, false, true);
ok = ok && bool4(half2x2(1, 1, 1, 1)) == bool4(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;
}