skia2/tests/sksl/shared/ConstArray.metal
John Stiles 82491c5d65 Enable proper testing of const arrays.
This test was generating invalid code in Metal
(http://review.skia.org/408356), but we didn't catch it because the code
wasn't actually being run.

Change-Id: I649034593a566f9e835b1cf7b0702c64952d31ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408641
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2021-05-14 13:37:12 +00:00

20 lines
560 B
Metal

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Inputs {
};
struct Outputs {
float4 sk_FragColor [[color(0)]];
};
struct Globals {
const array<float, 4> test;
};
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Globals _globals{array<float, 4>{0.0, 1.0, 0.0, 1.0}};
(void)_globals;
Outputs _out;
(void)_out;
_out.sk_FragColor = float4(_globals.test[0], _globals.test[1], _globals.test[2], _globals.test[3]);
return _out;
}