skia2/tests/sksl/shared/InoutParamsAreDistinct.metal
John Stiles 674eb326f4 Improve distinct-out-param test cases.
Added new aliasing tests inspired by syoussefi@'s ANGLE changes at
http://go/crrv/c/3561278.

Change-Id: Ifa312faa9503b211b7c09edd2abd5087ead35e5f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/526018
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Arman Uguray <armansito@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
2022-03-30 18:49:15 +00:00

34 lines
1.0 KiB
Metal

#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Uniforms {
half4 colorGreen;
half4 colorRed;
};
struct Inputs {
};
struct Outputs {
half4 sk_FragColor [[color(0)]];
};
bool inout_params_are_distinct_bhh(thread half& x, thread half& y);
bool _skOutParamHelper0_inout_params_are_distinct_bhh(thread half& x, thread half&) {
half _var0 = x;
half _var1 = x;
bool _skResult = inout_params_are_distinct_bhh(_var0, _var1);
x = _var0;
x = _var1;
return _skResult;
}
bool inout_params_are_distinct_bhh(thread half& x, thread half& y) {
x = 1.0h;
y = 2.0h;
return x == 1.0h && y == 2.0h;
}
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Outputs _out;
(void)_out;
half x = 0.0h;
_out.sk_FragColor = _skOutParamHelper0_inout_params_are_distinct_bhh(x, x) ? _uniforms.colorGreen : _uniforms.colorRed;
return _out;
}