skia2/tests/sksl/shared/ArrayConstructors.glsl
John Stiles dd904af566 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>
2021-02-03 22:33:19 +00:00

8 lines
243 B
GLSL

out vec4 sk_FragColor;
uniform vec4 colorGreen;
uniform vec4 colorRed;
vec4 main() {
return (float[4](1.0, 2.0, 3.0, 4.0)[3] + vec2[2](vec2(1.0, 2.0), vec2(3.0, 4.0))[1].y) + mat4[1](mat4(16.0))[0][3].w == 24.0 ? colorGreen : colorRed;
}