skia2/tests/sksl/shared/Assignment.metal

66 lines
1.5 KiB
Metal
Raw Normal View History

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct S {
float f;
array<float, 5> af;
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 h4;
array<half4, 5> ah4;
};
Reland "Improve support for arrays in Metal." This reverts commit 38df4c8470ab3db7455005ab0c3599a95c791d2b. Reason for revert: updated ArrayTypes test for ES2 compatibility Original change's description: > Revert "Improve support for arrays in Metal." > > This reverts commit dd904af5666b4746d4b9af5c1f03b47ac3ec73b2. > > Reason for revert: breaks ANGLE > > Original change's description: > > Improve support for arrays in Metal. > > > > Arrays in Metal now use the `array<T, N>` type instead of the C-style > > `T[N]` type. This gives them semantics much more in line with GLSL, > > so they can be initialized and assigned like GLSL arrays. > > > > This allows the ArrayTypes and Assignment tests to pass, so they have > > been added to our dm SkSL tests. (ArrayConstructors also passes, but > > is not ES2-compliant so it is not enabled.) > > > > Change-Id: Id1028311963084befd0e044e11e223af6a064dda > > Bug: skia:10761, skia:10760, skia:11022, skia:10939 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365699 > > Commit-Queue: John Stiles <johnstiles@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: If6a18dea7d6a45fa7836e9129bf81c2e536f07e3 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:10761 > Bug: skia:10760 > Bug: skia:11022 > Bug: skia:10939 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365976 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Bug: skia:10761 Bug: skia:10760 Bug: skia:11022 Bug: skia:10939 Change-Id: Ia1c4917f5d3c41162d282b3093814d861707ad30 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366144 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-04 15:57:08 +00:00
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;
};
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)]];
};
struct Globals {
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 globalVar;
S globalStruct;
};
Reland "Improve support for arrays in Metal." This reverts commit 38df4c8470ab3db7455005ab0c3599a95c791d2b. Reason for revert: updated ArrayTypes test for ES2 compatibility Original change's description: > Revert "Improve support for arrays in Metal." > > This reverts commit dd904af5666b4746d4b9af5c1f03b47ac3ec73b2. > > Reason for revert: breaks ANGLE > > Original change's description: > > Improve support for arrays in Metal. > > > > Arrays in Metal now use the `array<T, N>` type instead of the C-style > > `T[N]` type. This gives them semantics much more in line with GLSL, > > so they can be initialized and assigned like GLSL arrays. > > > > This allows the ArrayTypes and Assignment tests to pass, so they have > > been added to our dm SkSL tests. (ArrayConstructors also passes, but > > is not ES2-compliant so it is not enabled.) > > > > Change-Id: Id1028311963084befd0e044e11e223af6a064dda > > Bug: skia:10761, skia:10760, skia:11022, skia:10939 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365699 > > Commit-Queue: John Stiles <johnstiles@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: If6a18dea7d6a45fa7836e9129bf81c2e536f07e3 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:10761 > Bug: skia:10760 > Bug: skia:11022 > Bug: skia:10939 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365976 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Bug: skia:10761 Bug: skia:10760 Bug: skia:11022 Bug: skia:10939 Change-Id: Ia1c4917f5d3c41162d282b3093814d861707ad30 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366144 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-04 15:57:08 +00:00
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Globals _globals{{}, {}};
(void)_globals;
Outputs _out;
(void)_out;
int i;
i = 0;
Reland "Improve support for arrays in Metal." This reverts commit 38df4c8470ab3db7455005ab0c3599a95c791d2b. Reason for revert: updated ArrayTypes test for ES2 compatibility Original change's description: > Revert "Improve support for arrays in Metal." > > This reverts commit dd904af5666b4746d4b9af5c1f03b47ac3ec73b2. > > Reason for revert: breaks ANGLE > > Original change's description: > > Improve support for arrays in Metal. > > > > Arrays in Metal now use the `array<T, N>` type instead of the C-style > > `T[N]` type. This gives them semantics much more in line with GLSL, > > so they can be initialized and assigned like GLSL arrays. > > > > This allows the ArrayTypes and Assignment tests to pass, so they have > > been added to our dm SkSL tests. (ArrayConstructors also passes, but > > is not ES2-compliant so it is not enabled.) > > > > Change-Id: Id1028311963084befd0e044e11e223af6a064dda > > Bug: skia:10761, skia:10760, skia:11022, skia:10939 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365699 > > Commit-Queue: John Stiles <johnstiles@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: If6a18dea7d6a45fa7836e9129bf81c2e536f07e3 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:10761 > Bug: skia:10760 > Bug: skia:11022 > Bug: skia:10939 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365976 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Bug: skia:10761 Bug: skia:10760 Bug: skia:11022 Bug: skia:10939 Change-Id: Ia1c4917f5d3c41162d282b3093814d861707ad30 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366144 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-04 15:57:08 +00:00
int4 i4;
i4 = int4(1, 2, 3, 4);
float3x3 f3x3;
f3x3 = float3x3(float3(1.0, 2.0, 3.0), float3(4.0, 5.0, 6.0), float3(7.0, 8.0, 9.0));
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 x;
x.w = 0.0h;
x.yx = half2(0.0h);
Reland "Improve support for arrays in Metal." This reverts commit 38df4c8470ab3db7455005ab0c3599a95c791d2b. Reason for revert: updated ArrayTypes test for ES2 compatibility Original change's description: > Revert "Improve support for arrays in Metal." > > This reverts commit dd904af5666b4746d4b9af5c1f03b47ac3ec73b2. > > Reason for revert: breaks ANGLE > > Original change's description: > > Improve support for arrays in Metal. > > > > Arrays in Metal now use the `array<T, N>` type instead of the C-style > > `T[N]` type. This gives them semantics much more in line with GLSL, > > so they can be initialized and assigned like GLSL arrays. > > > > This allows the ArrayTypes and Assignment tests to pass, so they have > > been added to our dm SkSL tests. (ArrayConstructors also passes, but > > is not ES2-compliant so it is not enabled.) > > > > Change-Id: Id1028311963084befd0e044e11e223af6a064dda > > Bug: skia:10761, skia:10760, skia:11022, skia:10939 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365699 > > Commit-Queue: John Stiles <johnstiles@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: If6a18dea7d6a45fa7836e9129bf81c2e536f07e3 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:10761 > Bug: skia:10760 > Bug: skia:11022 > Bug: skia:10939 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365976 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Bug: skia:10761 Bug: skia:10760 Bug: skia:11022 Bug: skia:10939 Change-Id: Ia1c4917f5d3c41162d282b3093814d861707ad30 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366144 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-04 15:57:08 +00:00
array<int, 1> ai;
ai[0] = 0;
Reland "Improve support for arrays in Metal." This reverts commit 38df4c8470ab3db7455005ab0c3599a95c791d2b. Reason for revert: updated ArrayTypes test for ES2 compatibility Original change's description: > Revert "Improve support for arrays in Metal." > > This reverts commit dd904af5666b4746d4b9af5c1f03b47ac3ec73b2. > > Reason for revert: breaks ANGLE > > Original change's description: > > Improve support for arrays in Metal. > > > > Arrays in Metal now use the `array<T, N>` type instead of the C-style > > `T[N]` type. This gives them semantics much more in line with GLSL, > > so they can be initialized and assigned like GLSL arrays. > > > > This allows the ArrayTypes and Assignment tests to pass, so they have > > been added to our dm SkSL tests. (ArrayConstructors also passes, but > > is not ES2-compliant so it is not enabled.) > > > > Change-Id: Id1028311963084befd0e044e11e223af6a064dda > > Bug: skia:10761, skia:10760, skia:11022, skia:10939 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365699 > > Commit-Queue: John Stiles <johnstiles@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: If6a18dea7d6a45fa7836e9129bf81c2e536f07e3 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:10761 > Bug: skia:10760 > Bug: skia:11022 > Bug: skia:10939 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365976 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Bug: skia:10761 Bug: skia:10760 Bug: skia:11022 Bug: skia:10939 Change-Id: Ia1c4917f5d3c41162d282b3093814d861707ad30 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366144 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-04 15:57:08 +00:00
array<int4, 1> ai4;
ai4[0] = int4(1, 2, 3, 4);
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
array<half3x3, 1> ah2x4;
ah2x4[0] = half3x3(half3(1.0h, 2.0h, 3.0h), half3(4.0h, 5.0h, 6.0h), half3(7.0h, 8.0h, 9.0h));
Reland "Improve support for arrays in Metal." This reverts commit 38df4c8470ab3db7455005ab0c3599a95c791d2b. Reason for revert: updated ArrayTypes test for ES2 compatibility Original change's description: > Revert "Improve support for arrays in Metal." > > This reverts commit dd904af5666b4746d4b9af5c1f03b47ac3ec73b2. > > Reason for revert: breaks ANGLE > > Original change's description: > > Improve support for arrays in Metal. > > > > Arrays in Metal now use the `array<T, N>` type instead of the C-style > > `T[N]` type. This gives them semantics much more in line with GLSL, > > so they can be initialized and assigned like GLSL arrays. > > > > This allows the ArrayTypes and Assignment tests to pass, so they have > > been added to our dm SkSL tests. (ArrayConstructors also passes, but > > is not ES2-compliant so it is not enabled.) > > > > Change-Id: Id1028311963084befd0e044e11e223af6a064dda > > Bug: skia:10761, skia:10760, skia:11022, skia:10939 > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365699 > > Commit-Queue: John Stiles <johnstiles@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: If6a18dea7d6a45fa7836e9129bf81c2e536f07e3 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: skia:10761 > Bug: skia:10760 > Bug: skia:11022 > Bug: skia:10939 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365976 > Reviewed-by: John Stiles <johnstiles@google.com> > Commit-Queue: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Bug: skia:10761 Bug: skia:10760 Bug: skia:11022 Bug: skia:10939 Change-Id: Ia1c4917f5d3c41162d282b3093814d861707ad30 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366144 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
2021-02-04 15:57:08 +00:00
array<float4, 1> af4;
af4[0].x = 0.0;
af4[0].ywxz = float4(1.0);
S s;
s.f = 0.0;
s.af[1] = 0.0;
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
s.h4.zxy = half3(9.0h);
s.ah4[2].yw = half2(5.0h);
_globals.globalVar = half4(0.0h);
_globals.globalStruct.f = 0.0;
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
half l;
l = 0.0h;
ai[0] += ai4[0].x;
s.f = 1.0;
s.af[0] = 2.0;
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
s.h4 = half4(1.0h);
s.ah4[0] = half4(2.0h);
af4[0] *= float(ah2x4[0][0].x);
i4.y = i4.y * i;
x.y = x.y * l;
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
s.f *= float(l);
_out.sk_FragColor = _uniforms.colorGreen;
return _out;
}