skia2/tests/sksl/shared/Matrices.metal

145 lines
6.3 KiB
Metal
Raw Normal View History

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Uniforms {
Reland "Add support for half-precision types in Metal." This reverts commit 9d24b02c2fdb5eede1054b16b9c03b5ed26dc618. Reason for revert: needs premul/unpremul conversion fix (http://review.skia.org/465798) Original change's description: > Revert "Add support for half-precision types in Metal." > > This reverts commit d90e09b1ae0939b463f59f81c2958b8c08f5027b. > > Reason for revert: MacMini failing CompressedBackendAllocationTest > > Original change's description: > > Add support for half-precision types in Metal. > > > > This will hopefully improve performance on lower-end GPUs. > > > > Change-Id: I9c2ee6dc31acd08bec0bfb5f59edc3cf90163f9e > > Bug: skia:12339 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465078 > > Auto-Submit: John Stiles <johnstiles@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Bug: skia:12339 > Change-Id: Ic5aa4bef454ca67f5ce26c600444d9565e0158cb > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465796 > Auto-Submit: Brian Osman <brianosman@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bug: skia:12339 Change-Id: I53a8a6fef299da15d206d884ba7029820ffcff43 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465799 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-30 02:34:51 +00:00
half4 colorGreen;
half4 colorRed;
};
struct Inputs {
};
struct Outputs {
Reland "Add support for half-precision types in Metal." This reverts commit 9d24b02c2fdb5eede1054b16b9c03b5ed26dc618. Reason for revert: needs premul/unpremul conversion fix (http://review.skia.org/465798) Original change's description: > Revert "Add support for half-precision types in Metal." > > This reverts commit d90e09b1ae0939b463f59f81c2958b8c08f5027b. > > Reason for revert: MacMini failing CompressedBackendAllocationTest > > Original change's description: > > Add support for half-precision types in Metal. > > > > This will hopefully improve performance on lower-end GPUs. > > > > Change-Id: I9c2ee6dc31acd08bec0bfb5f59edc3cf90163f9e > > Bug: skia:12339 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465078 > > Auto-Submit: John Stiles <johnstiles@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Bug: skia:12339 > Change-Id: Ic5aa4bef454ca67f5ce26c600444d9565e0158cb > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465796 > Auto-Submit: Brian Osman <brianosman@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bug: skia:12339 Change-Id: I53a8a6fef299da15d206d884ba7029820ffcff43 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465799 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-30 02:34:51 +00:00
half4 sk_FragColor [[color(0)]];
};
Reland "Fix array-of-matrix/struct comparisons in Metal." This is a reland of 23d8f94535813d7c973af69aaeb67a0e5d7c9140 Original change's description: > Fix array-of-matrix/struct comparisons in Metal. > > Metal needs helper functions in order to compare arrays, structs, and > matrices. Depending on the input code, it was possible for the > array-comparison helper to be emitted before a matrix-comparison > or struct-comparison helper. If this occurred, array comparisons of that > matrix or struct type would fail, because the operator== for the array's > inner type was defined after array==, and Metal (like C++) parses > top-to-bottom and only considers functions declared above the current > function. > > We now emit prototypes for all the array, struct and matrix helper > function. These prototypes are emitted above any helper functions. This > ensures visibility no matter how your comparisons are organized. > > Change-Id: Ib3d8828c301fd0fa6c209788f9ea60800371edbe > Bug: skia:12326 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437739 > Commit-Queue: John Stiles <johnstiles@google.com> > Auto-Submit: John Stiles <johnstiles@google.com> > Reviewed-by: Brian Osman <brianosman@google.com> Bug: skia:12326 Change-Id: Ife68020f6b01fae973b97f76099c6d5e8215636c Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438296 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
2021-08-10 20:03:23 +00:00
Reland "Add support for half-precision types in Metal." This reverts commit 9d24b02c2fdb5eede1054b16b9c03b5ed26dc618. Reason for revert: needs premul/unpremul conversion fix (http://review.skia.org/465798) Original change's description: > Revert "Add support for half-precision types in Metal." > > This reverts commit d90e09b1ae0939b463f59f81c2958b8c08f5027b. > > Reason for revert: MacMini failing CompressedBackendAllocationTest > > Original change's description: > > Add support for half-precision types in Metal. > > > > This will hopefully improve performance on lower-end GPUs. > > > > Change-Id: I9c2ee6dc31acd08bec0bfb5f59edc3cf90163f9e > > Bug: skia:12339 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465078 > > Auto-Submit: John Stiles <johnstiles@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Bug: skia:12339 > Change-Id: Ic5aa4bef454ca67f5ce26c600444d9565e0158cb > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465796 > Auto-Submit: Brian Osman <brianosman@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bug: skia:12339 Change-Id: I53a8a6fef299da15d206d884ba7029820ffcff43 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465799 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-30 02:34:51 +00:00
thread bool operator==(const half2x2 left, const half2x2 right);
thread bool operator!=(const half2x2 left, const half2x2 right);
thread bool operator==(const half3x3 left, const half3x3 right);
thread bool operator!=(const half3x3 left, const half3x3 right);
thread bool operator==(const half4x4 left, const half4x4 right);
thread bool operator!=(const half4x4 left, const half4x4 right);
Reland "Fix array-of-matrix/struct comparisons in Metal." This is a reland of 23d8f94535813d7c973af69aaeb67a0e5d7c9140 Original change's description: > Fix array-of-matrix/struct comparisons in Metal. > > Metal needs helper functions in order to compare arrays, structs, and > matrices. Depending on the input code, it was possible for the > array-comparison helper to be emitted before a matrix-comparison > or struct-comparison helper. If this occurred, array comparisons of that > matrix or struct type would fail, because the operator== for the array's > inner type was defined after array==, and Metal (like C++) parses > top-to-bottom and only considers functions declared above the current > function. > > We now emit prototypes for all the array, struct and matrix helper > function. These prototypes are emitted above any helper functions. This > ensures visibility no matter how your comparisons are organized. > > Change-Id: Ib3d8828c301fd0fa6c209788f9ea60800371edbe > Bug: skia:12326 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437739 > Commit-Queue: John Stiles <johnstiles@google.com> > Auto-Submit: John Stiles <johnstiles@google.com> > Reviewed-by: Brian Osman <brianosman@google.com> Bug: skia:12326 Change-Id: Ife68020f6b01fae973b97f76099c6d5e8215636c Reviewed-on: https://skia-review.googlesource.com/c/skia/+/438296 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
2021-08-10 20:03:23 +00:00
thread bool operator==(const float2x2 left, const float2x2 right);
thread bool operator!=(const float2x2 left, const float2x2 right);
thread bool operator==(const float3x3 left, const float3x3 right);
thread bool operator!=(const float3x3 left, const float3x3 right);
thread bool operator==(const float4x4 left, const float4x4 right);
thread bool operator!=(const float4x4 left, const float4x4 right);
Reland "Add support for half-precision types in Metal." This reverts commit 9d24b02c2fdb5eede1054b16b9c03b5ed26dc618. Reason for revert: needs premul/unpremul conversion fix (http://review.skia.org/465798) Original change's description: > Revert "Add support for half-precision types in Metal." > > This reverts commit d90e09b1ae0939b463f59f81c2958b8c08f5027b. > > Reason for revert: MacMini failing CompressedBackendAllocationTest > > Original change's description: > > Add support for half-precision types in Metal. > > > > This will hopefully improve performance on lower-end GPUs. > > > > Change-Id: I9c2ee6dc31acd08bec0bfb5f59edc3cf90163f9e > > Bug: skia:12339 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465078 > > Auto-Submit: John Stiles <johnstiles@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Bug: skia:12339 > Change-Id: Ic5aa4bef454ca67f5ce26c600444d9565e0158cb > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465796 > Auto-Submit: Brian Osman <brianosman@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bug: skia:12339 Change-Id: I53a8a6fef299da15d206d884ba7029820ffcff43 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465799 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-30 02:34:51 +00:00
thread bool operator==(const half2x2 left, const half2x2 right) {
return all(left[0] == right[0]) &&
all(left[1] == right[1]);
}
thread bool operator!=(const half2x2 left, const half2x2 right) {
return !(left == right);
}
thread half2x2& operator*=(thread half2x2& left, thread const half2x2& right) {
left = left * right;
return left;
}
thread bool operator==(const half3x3 left, const half3x3 right) {
return all(left[0] == right[0]) &&
all(left[1] == right[1]) &&
all(left[2] == right[2]);
}
thread bool operator!=(const half3x3 left, const half3x3 right) {
return !(left == right);
}
thread bool operator==(const half4x4 left, const half4x4 right) {
return all(left[0] == right[0]) &&
all(left[1] == right[1]) &&
all(left[2] == right[2]) &&
all(left[3] == right[3]);
}
thread bool operator!=(const half4x4 left, const half4x4 right) {
return !(left == right);
}
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
thread bool operator==(const float2x2 left, const float2x2 right) {
return all(left[0] == right[0]) &&
all(left[1] == right[1]);
}
thread bool operator!=(const float2x2 left, const float2x2 right) {
return !(left == right);
}
thread float2x2& operator*=(thread float2x2& left, thread const float2x2& right) {
left = left * right;
return left;
}
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
thread bool operator==(const float3x3 left, const float3x3 right) {
return all(left[0] == right[0]) &&
all(left[1] == right[1]) &&
all(left[2] == right[2]);
}
thread bool operator!=(const float3x3 left, const float3x3 right) {
return !(left == right);
}
thread bool operator==(const float4x4 left, const float4x4 right) {
return all(left[0] == right[0]) &&
all(left[1] == right[1]) &&
all(left[2] == right[2]) &&
all(left[3] == right[3]);
}
thread bool operator!=(const float4x4 left, const float4x4 right) {
return !(left == right);
}
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;
Reland "Add support for half-precision types in Metal." This reverts commit 9d24b02c2fdb5eede1054b16b9c03b5ed26dc618. Reason for revert: needs premul/unpremul conversion fix (http://review.skia.org/465798) Original change's description: > Revert "Add support for half-precision types in Metal." > > This reverts commit d90e09b1ae0939b463f59f81c2958b8c08f5027b. > > Reason for revert: MacMini failing CompressedBackendAllocationTest > > Original change's description: > > Add support for half-precision types in Metal. > > > > This will hopefully improve performance on lower-end GPUs. > > > > Change-Id: I9c2ee6dc31acd08bec0bfb5f59edc3cf90163f9e > > Bug: skia:12339 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465078 > > Auto-Submit: John Stiles <johnstiles@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Bug: skia:12339 > Change-Id: Ic5aa4bef454ca67f5ce26c600444d9565e0158cb > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465796 > Auto-Submit: Brian Osman <brianosman@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bug: skia:12339 Change-Id: I53a8a6fef299da15d206d884ba7029820ffcff43 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465799 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-30 02:34:51 +00:00
half2x2 m1 = half2x2(half2(1.0h, 2.0h), half2(3.0h, 4.0h));
ok = ok && m1 == half2x2(half2(1.0h, 2.0h), half2(3.0h, 4.0h));
half2x2 m3 = m1;
ok = ok && m3 == half2x2(half2(1.0h, 2.0h), half2(3.0h, 4.0h));
half2x2 m4 = half2x2(6.0h);
ok = ok && m4 == half2x2(half2(6.0h, 0.0h), half2(0.0h, 6.0h));
m3 *= m4;
Reland "Add support for half-precision types in Metal." This reverts commit 9d24b02c2fdb5eede1054b16b9c03b5ed26dc618. Reason for revert: needs premul/unpremul conversion fix (http://review.skia.org/465798) Original change's description: > Revert "Add support for half-precision types in Metal." > > This reverts commit d90e09b1ae0939b463f59f81c2958b8c08f5027b. > > Reason for revert: MacMini failing CompressedBackendAllocationTest > > Original change's description: > > Add support for half-precision types in Metal. > > > > This will hopefully improve performance on lower-end GPUs. > > > > Change-Id: I9c2ee6dc31acd08bec0bfb5f59edc3cf90163f9e > > Bug: skia:12339 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465078 > > Auto-Submit: John Stiles <johnstiles@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Bug: skia:12339 > Change-Id: Ic5aa4bef454ca67f5ce26c600444d9565e0158cb > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465796 > Auto-Submit: Brian Osman <brianosman@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bug: skia:12339 Change-Id: I53a8a6fef299da15d206d884ba7029820ffcff43 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465799 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-30 02:34:51 +00:00
ok = ok && m3 == half2x2(half2(6.0h, 12.0h), half2(18.0h, 24.0h));
half2x2 m5 = half2x2(m1[1].y);
ok = ok && m5 == half2x2(half2(4.0h, 0.0h), half2(0.0h, 4.0h));
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
m1 += m5;
Reland "Add support for half-precision types in Metal." This reverts commit 9d24b02c2fdb5eede1054b16b9c03b5ed26dc618. Reason for revert: needs premul/unpremul conversion fix (http://review.skia.org/465798) Original change's description: > Revert "Add support for half-precision types in Metal." > > This reverts commit d90e09b1ae0939b463f59f81c2958b8c08f5027b. > > Reason for revert: MacMini failing CompressedBackendAllocationTest > > Original change's description: > > Add support for half-precision types in Metal. > > > > This will hopefully improve performance on lower-end GPUs. > > > > Change-Id: I9c2ee6dc31acd08bec0bfb5f59edc3cf90163f9e > > Bug: skia:12339 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465078 > > Auto-Submit: John Stiles <johnstiles@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Bug: skia:12339 > Change-Id: Ic5aa4bef454ca67f5ce26c600444d9565e0158cb > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465796 > Auto-Submit: Brian Osman <brianosman@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bug: skia:12339 Change-Id: I53a8a6fef299da15d206d884ba7029820ffcff43 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465799 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-30 02:34:51 +00:00
ok = ok && m1 == half2x2(half2(5.0h, 2.0h), half2(3.0h, 8.0h));
half2x2 m7 = half2x2(half2(5.0h, 6.0h), half2(7.0h, 8.0h));
ok = ok && m7 == half2x2(half2(5.0h, 6.0h), half2(7.0h, 8.0h));
half3x3 m9 = half3x3(9.0h);
ok = ok && m9 == half3x3(half3(9.0h, 0.0h, 0.0h), half3(0.0h, 9.0h, 0.0h), half3(0.0h, 0.0h, 9.0h));
half4x4 m10 = half4x4(11.0h);
ok = ok && m10 == half4x4(half4(11.0h, 0.0h, 0.0h, 0.0h), half4(0.0h, 11.0h, 0.0h, 0.0h), half4(0.0h, 0.0h, 11.0h, 0.0h), half4(0.0h, 0.0h, 0.0h, 11.0h));
half4x4 m11 = half4x4(half4(20.0h, 20.0h, 20.0h, 20.0h), half4(20.0h, 20.0h, 20.0h, 20.0h), half4(20.0h, 20.0h, 20.0h, 20.0h), half4(20.0h, 20.0h, 20.0h, 20.0h));
m11 -= m10;
Reland "Add support for half-precision types in Metal." This reverts commit 9d24b02c2fdb5eede1054b16b9c03b5ed26dc618. Reason for revert: needs premul/unpremul conversion fix (http://review.skia.org/465798) Original change's description: > Revert "Add support for half-precision types in Metal." > > This reverts commit d90e09b1ae0939b463f59f81c2958b8c08f5027b. > > Reason for revert: MacMini failing CompressedBackendAllocationTest > > Original change's description: > > Add support for half-precision types in Metal. > > > > This will hopefully improve performance on lower-end GPUs. > > > > Change-Id: I9c2ee6dc31acd08bec0bfb5f59edc3cf90163f9e > > Bug: skia:12339 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465078 > > Auto-Submit: John Stiles <johnstiles@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > Bug: skia:12339 > Change-Id: Ic5aa4bef454ca67f5ce26c600444d9565e0158cb > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465796 > Auto-Submit: Brian Osman <brianosman@google.com> > Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bug: skia:12339 Change-Id: I53a8a6fef299da15d206d884ba7029820ffcff43 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/465799 Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-10-30 02:34:51 +00:00
ok = ok && m11 == half4x4(half4(9.0h, 20.0h, 20.0h, 20.0h), half4(20.0h, 9.0h, 20.0h, 20.0h), half4(20.0h, 20.0h, 9.0h, 20.0h), half4(20.0h, 20.0h, 20.0h, 9.0h));
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
return ok;
}
bool test_comma_b() {
float2x2 x;
float2x2 y;
return ((x = float2x2(float2(1.0, 2.0), float2(3.0, 4.0)), y = 0.5 * float2x2(float2(2.0, 4.0), float2(6.0, 8.0))), x == y);
}
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Outputs _out;
(void)_out;
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;
float2x2 _1_m1 = float2x2(float2(1.0, 2.0), float2(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 == float2x2(float2(1.0, 2.0), float2(3.0, 4.0));
float2x2 _2_m3 = _1_m1;
_0_ok = _0_ok && _2_m3 == float2x2(float2(1.0, 2.0), float2(3.0, 4.0));
float2x2 _3_m4 = float2x2(6.0);
_0_ok = _0_ok && _3_m4 == float2x2(float2(6.0, 0.0), float2(0.0, 6.0));
_2_m3 *= _3_m4;
_0_ok = _0_ok && _2_m3 == float2x2(float2(6.0, 12.0), float2(18.0, 24.0));
float2x2 _4_m5 = float2x2(_1_m1[1].y);
_0_ok = _0_ok && _4_m5 == float2x2(float2(4.0, 0.0), float2(0.0, 4.0));
_1_m1 += _4_m5;
_0_ok = _0_ok && _1_m1 == float2x2(float2(5.0, 2.0), float2(3.0, 8.0));
float2x2 _5_m7 = float2x2(float2(5.0, 6.0), float2(7.0, 8.0));
_0_ok = _0_ok && _5_m7 == float2x2(float2(5.0, 6.0), float2(7.0, 8.0));
float3x3 _6_m9 = float3x3(9.0);
_0_ok = _0_ok && _6_m9 == float3x3(float3(9.0, 0.0, 0.0), float3(0.0, 9.0, 0.0), float3(0.0, 0.0, 9.0));
float4x4 _7_m10 = float4x4(11.0);
_0_ok = _0_ok && _7_m10 == float4x4(float4(11.0, 0.0, 0.0, 0.0), float4(0.0, 11.0, 0.0, 0.0), float4(0.0, 0.0, 11.0, 0.0), float4(0.0, 0.0, 0.0, 11.0));
float4x4 _8_m11 = float4x4(float4(20.0, 20.0, 20.0, 20.0), float4(20.0, 20.0, 20.0, 20.0), float4(20.0, 20.0, 20.0, 20.0), float4(20.0, 20.0, 20.0, 20.0));
_8_m11 -= _7_m10;
_0_ok = _0_ok && _8_m11 == float4x4(float4(9.0, 20.0, 20.0, 20.0), float4(20.0, 9.0, 20.0, 20.0), float4(20.0, 20.0, 9.0, 20.0), float4(20.0, 20.0, 20.0, 9.0));
_out.sk_FragColor = (_0_ok && test_half_b()) && test_comma_b() ? _uniforms.colorGreen : _uniforms.colorRed;
return _out;
}