skia2/tests/sksl/shared/StructMaxDepth.metal
Brian Osman 58134e1408 Fix const globals in Metal
We were emitting this at global scope (not in Globals). That would lead
to errors about the variable needing to be in the constant address
space. (You can see the result in ConstArray.metal - the old code was
invalid). Also, we were already making references use _globals, so the
code was double-wrong (or half-right, depending on your perspective).

After the core change, writeVarDeclaration was only used for local
scope, and writeModifiers never used the 'globalContext' parameter.

The removal of finishLine() changed every test output, unfortunately.

Change-Id: Icc1356ba2cc3c339b2f5759b3d18523fd39395bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408356
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-05-13 21:11:10 +00:00

59 lines
678 B
Metal

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct S1 {
int x;
};
struct S2 {
S1 x;
};
struct S3 {
S2 x;
};
struct S4 {
S3 x;
};
struct S5 {
S4 x;
};
struct S6 {
S5 x;
};
struct S7 {
S6 x;
};
struct S8 {
S7 x;
};
struct SA1 {
array<int, 8> x;
};
struct SA2 {
array<SA1, 7> x;
};
struct SA3 {
array<SA2, 6> x;
};
struct SA4 {
array<SA3, 5> x;
};
struct SA5 {
array<SA4, 4> x;
};
struct SA6 {
array<SA5, 3> x;
};
struct SA7 {
array<SA6, 2> x;
};
struct SA8 {
array<SA7, 1> x;
};
struct Inputs {
S8 s8;
array<SA8, 9> sa8;
};
struct Outputs {
float4 sk_FragColor [[color(0)]];
};