skia2/tests/sksl/shared/Matrices.glsl

60 lines
2.5 KiB
Plaintext
Raw Normal View History

out vec4 sk_FragColor;
uniform vec4 colorGreen;
uniform vec4 colorRed;
bool test_half_b() {
Reland "The Matrices test now verifies its results." This reverts commit 90508f02dc599ccec1319bfd54617d3548293668. Reason for revert: avoiding driver bugs this time Original change's description: > Revert "The Matrices test now verifies its results." > > This reverts commit 86121f6c0e502e9ef35355162ba64c045f59c0b4. > > Reason for revert: tree sad > > Original change's description: > > The Matrices test now verifies its results. > > > > Previously, this test did a bunch of matrix math but never actually > > checked its results for correctness. > > > > Change-Id: I353be58049286266c2d561b0939b3874d2684403 > > Bug: skia:11985 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407360 > > 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> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I1335f01c14ee955426e02efaa3c30421cd41aa34 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:11985 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407617 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> Bug: skia:11985 Change-Id: I214375d74977f324973da72c440d7ff5ff179016 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408157 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-05-13 15:30:22 +00:00
bool ok = true;
mat2 m1 = mat2(1.0, 2.0, 3.0, 4.0);
Reland "The Matrices test now verifies its results." This reverts commit 90508f02dc599ccec1319bfd54617d3548293668. Reason for revert: avoiding driver bugs this time Original change's description: > Revert "The Matrices test now verifies its results." > > This reverts commit 86121f6c0e502e9ef35355162ba64c045f59c0b4. > > Reason for revert: tree sad > > Original change's description: > > The Matrices test now verifies its results. > > > > Previously, this test did a bunch of matrix math but never actually > > checked its results for correctness. > > > > Change-Id: I353be58049286266c2d561b0939b3874d2684403 > > Bug: skia:11985 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407360 > > 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> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I1335f01c14ee955426e02efaa3c30421cd41aa34 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:11985 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407617 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> Bug: skia:11985 Change-Id: I214375d74977f324973da72c440d7ff5ff179016 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408157 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-05-13 15:30:22 +00:00
ok = ok && m1 == mat2(1.0, 2.0, 3.0, 4.0);
mat2 m3 = m1;
Reland "The Matrices test now verifies its results." This reverts commit 90508f02dc599ccec1319bfd54617d3548293668. Reason for revert: avoiding driver bugs this time Original change's description: > Revert "The Matrices test now verifies its results." > > This reverts commit 86121f6c0e502e9ef35355162ba64c045f59c0b4. > > Reason for revert: tree sad > > Original change's description: > > The Matrices test now verifies its results. > > > > Previously, this test did a bunch of matrix math but never actually > > checked its results for correctness. > > > > Change-Id: I353be58049286266c2d561b0939b3874d2684403 > > Bug: skia:11985 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407360 > > 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> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I1335f01c14ee955426e02efaa3c30421cd41aa34 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:11985 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407617 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> Bug: skia:11985 Change-Id: I214375d74977f324973da72c440d7ff5ff179016 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408157 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-05-13 15:30:22 +00:00
ok = ok && m3 == mat2(1.0, 2.0, 3.0, 4.0);
mat2 m4 = mat2(6.0);
ok = ok && m4 == mat2(6.0, 0.0, 0.0, 6.0);
m3 *= m4;
Reland "The Matrices test now verifies its results." This reverts commit 90508f02dc599ccec1319bfd54617d3548293668. Reason for revert: avoiding driver bugs this time Original change's description: > Revert "The Matrices test now verifies its results." > > This reverts commit 86121f6c0e502e9ef35355162ba64c045f59c0b4. > > Reason for revert: tree sad > > Original change's description: > > The Matrices test now verifies its results. > > > > Previously, this test did a bunch of matrix math but never actually > > checked its results for correctness. > > > > Change-Id: I353be58049286266c2d561b0939b3874d2684403 > > Bug: skia:11985 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407360 > > 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> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I1335f01c14ee955426e02efaa3c30421cd41aa34 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:11985 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407617 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> Bug: skia:11985 Change-Id: I214375d74977f324973da72c440d7ff5ff179016 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408157 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-05-13 15:30:22 +00:00
ok = ok && m3 == mat2(6.0, 12.0, 18.0, 24.0);
mat2 m5 = mat2(m1[1].y);
ok = ok && m5 == mat2(4.0, 0.0, 0.0, 4.0);
m1 += m5;
ok = ok && m1 == mat2(5.0, 2.0, 3.0, 8.0);
mat2 m7 = mat2(5.0, 6.0, 7.0, 8.0);
ok = ok && m7 == mat2(5.0, 6.0, 7.0, 8.0);
mat3 m9 = mat3(9.0);
ok = ok && m9 == mat3(9.0, 0.0, 0.0, 0.0, 9.0, 0.0, 0.0, 0.0, 9.0);
mat4 m10 = mat4(11.0);
ok = ok && m10 == mat4(11.0, 0.0, 0.0, 0.0, 0.0, 11.0, 0.0, 0.0, 0.0, 0.0, 11.0, 0.0, 0.0, 0.0, 0.0, 11.0);
mat4 m11 = mat4(20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0);
m11 -= m10;
Reland "The Matrices test now verifies its results." This reverts commit 90508f02dc599ccec1319bfd54617d3548293668. Reason for revert: avoiding driver bugs this time Original change's description: > Revert "The Matrices test now verifies its results." > > This reverts commit 86121f6c0e502e9ef35355162ba64c045f59c0b4. > > Reason for revert: tree sad > > Original change's description: > > The Matrices test now verifies its results. > > > > Previously, this test did a bunch of matrix math but never actually > > checked its results for correctness. > > > > Change-Id: I353be58049286266c2d561b0939b3874d2684403 > > Bug: skia:11985 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407360 > > 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> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I1335f01c14ee955426e02efaa3c30421cd41aa34 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:11985 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407617 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> Bug: skia:11985 Change-Id: I214375d74977f324973da72c440d7ff5ff179016 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408157 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-05-13 15:30:22 +00:00
ok = ok && m11 == mat4(9.0, 20.0, 20.0, 20.0, 20.0, 9.0, 20.0, 20.0, 20.0, 20.0, 9.0, 20.0, 20.0, 20.0, 20.0, 9.0);
return ok;
}
bool test_comma_b() {
mat2 x;
mat2 y;
return ((x = mat2(1.0, 2.0, 3.0, 4.0) , y = 0.5 * mat2(2.0, 4.0, 6.0, 8.0)) , x == y);
}
vec4 main() {
Reland "The Matrices test now verifies its results." This reverts commit 90508f02dc599ccec1319bfd54617d3548293668. Reason for revert: avoiding driver bugs this time Original change's description: > Revert "The Matrices test now verifies its results." > > This reverts commit 86121f6c0e502e9ef35355162ba64c045f59c0b4. > > Reason for revert: tree sad > > Original change's description: > > The Matrices test now verifies its results. > > > > Previously, this test did a bunch of matrix math but never actually > > checked its results for correctness. > > > > Change-Id: I353be58049286266c2d561b0939b3874d2684403 > > Bug: skia:11985 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407360 > > 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> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I1335f01c14ee955426e02efaa3c30421cd41aa34 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:11985 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407617 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> Bug: skia:11985 Change-Id: I214375d74977f324973da72c440d7ff5ff179016 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408157 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-05-13 15:30:22 +00:00
bool _0_ok = true;
mat2 _1_m1 = mat2(1.0, 2.0, 3.0, 4.0);
Reland "The Matrices test now verifies its results." This reverts commit 90508f02dc599ccec1319bfd54617d3548293668. Reason for revert: avoiding driver bugs this time Original change's description: > Revert "The Matrices test now verifies its results." > > This reverts commit 86121f6c0e502e9ef35355162ba64c045f59c0b4. > > Reason for revert: tree sad > > Original change's description: > > The Matrices test now verifies its results. > > > > Previously, this test did a bunch of matrix math but never actually > > checked its results for correctness. > > > > Change-Id: I353be58049286266c2d561b0939b3874d2684403 > > Bug: skia:11985 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407360 > > 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> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I1335f01c14ee955426e02efaa3c30421cd41aa34 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:11985 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407617 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> Bug: skia:11985 Change-Id: I214375d74977f324973da72c440d7ff5ff179016 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408157 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-05-13 15:30:22 +00:00
_0_ok = _0_ok && _1_m1 == mat2(1.0, 2.0, 3.0, 4.0);
mat2 _2_m3 = _1_m1;
_0_ok = _0_ok && _2_m3 == mat2(1.0, 2.0, 3.0, 4.0);
mat2 _3_m4 = mat2(6.0);
_0_ok = _0_ok && _3_m4 == mat2(6.0, 0.0, 0.0, 6.0);
_2_m3 *= _3_m4;
_0_ok = _0_ok && _2_m3 == mat2(6.0, 12.0, 18.0, 24.0);
mat2 _4_m5 = mat2(_1_m1[1].y);
_0_ok = _0_ok && _4_m5 == mat2(4.0, 0.0, 0.0, 4.0);
_1_m1 += _4_m5;
_0_ok = _0_ok && _1_m1 == mat2(5.0, 2.0, 3.0, 8.0);
mat2 _5_m7 = mat2(5.0, 6.0, 7.0, 8.0);
_0_ok = _0_ok && _5_m7 == mat2(5.0, 6.0, 7.0, 8.0);
mat3 _6_m9 = mat3(9.0);
_0_ok = _0_ok && _6_m9 == mat3(9.0, 0.0, 0.0, 0.0, 9.0, 0.0, 0.0, 0.0, 9.0);
mat4 _7_m10 = mat4(11.0);
_0_ok = _0_ok && _7_m10 == mat4(11.0, 0.0, 0.0, 0.0, 0.0, 11.0, 0.0, 0.0, 0.0, 0.0, 11.0, 0.0, 0.0, 0.0, 0.0, 11.0);
mat4 _8_m11 = mat4(20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0);
_8_m11 -= _7_m10;
_0_ok = _0_ok && _8_m11 == mat4(9.0, 20.0, 20.0, 20.0, 20.0, 9.0, 20.0, 20.0, 20.0, 20.0, 9.0, 20.0, 20.0, 20.0, 20.0, 9.0);
return (_0_ok && test_half_b()) && test_comma_b() ? colorGreen : colorRed;
}