skia2/tests/sksl/shared/Structs.metal
John Stiles 38df4c8470 Revert "Improve support for arrays in Metal."
This reverts commit dd904af566.

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>
2021-02-04 00:50:34 +00:00

34 lines
617 B
Metal

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct A {
int x;
int y;
};
struct B {
float x;
float y[2];
A z;
};
struct Inputs {
};
struct Outputs {
float4 sk_FragColor [[color(0)]];
};
struct Globals {
A a1;
B b1;
};
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Globals _globals{{}, {}};
(void)_globals;
Outputs _out;
(void)_out;
_globals.a1.x = 0;
_globals.b1.x = 0.0;
_out.sk_FragColor.x = float(_globals.a1.x) + _globals.b1.x;
return _out;
}