dd904af566
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>
35 lines
921 B
Metal
35 lines
921 B
Metal
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
using namespace metal;
|
|
struct Uniforms {
|
|
float4 colorGreen;
|
|
};
|
|
struct Inputs {
|
|
};
|
|
struct Outputs {
|
|
float4 sk_FragColor [[color(0)]];
|
|
};
|
|
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
|
Outputs _out;
|
|
(void)_out;
|
|
int4 i4;
|
|
i4 = int4(1, 2, 3, 4);
|
|
float4 x;
|
|
x.w = 0.0;
|
|
x.yx = float2(0.0);
|
|
array<int, 1> ai;
|
|
ai[0] = 0;
|
|
array<int4, 1> ai4;
|
|
ai4[0] = int4(1, 2, 3, 4);
|
|
array<float3x3, 1> ah2x4;
|
|
ah2x4[0] = float3x3(float3(1.0, 2.0, 3.0), float3(4.0, 5.0, 6.0), float3(7.0, 8.0, 9.0));
|
|
array<float4, 1> af4;
|
|
af4[0].x = 0.0;
|
|
af4[0].ywxz = float4(1.0);
|
|
i4.y = i4.y * 0;
|
|
x.y = x.y * 0.0;
|
|
_out.sk_FragColor = ((((ai , ai4) , ah2x4) , af4) , _uniforms.colorGreen);
|
|
return _out;
|
|
}
|