skia2/tests/sksl/shared/SwizzleScalar.metal
John Stiles 7f56b41fc0 Add scalar-swizzling tests for int and bool types.
Boolean scalar-swizzling is currently not working.

Change-Id: Icd965e4b64a12311d098168f65622110d5fb3437
Bug: skia:12195
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/427038
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
2021-07-12 19:54:40 +00:00

22 lines
680 B
Metal

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Uniforms {
float unknownInput;
};
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;
float4 h4 = float4(_uniforms.unknownInput);
h4 = float4(float2(_uniforms.unknownInput), 0.0, 1.0);
h4 = float4(0.0, _uniforms.unknownInput, 1.0, 0.0);
h4 = float4(0.0, _uniforms.unknownInput, 0.0, _uniforms.unknownInput);
_out.sk_FragColor = h4;
return _out;
}