skia2/tests/sksl/shared/OutParamsAreDistinct.metal
John Stiles c3d8062555 Fix up SkSL test on Wembley.
Test "InlinerHonorsGLSLOutParamSemantics" was failing on Wembley devices
and is now disabled on that GPU.

Also, it turns out that the inliner has ignored functions with out
params for a long time now, but our test names haven't been updated to
account for this. So, did some additional cleanup:
- "InlinerHonorsGLSLOutParamSemantics" (the test in question) has been
  moved to shared/ and renamed to "OutParamsAreDistinct."
- Removed test "OutParamsNoInline" as it is functionally the same as
  "OutParams".

Change-Id: I1431ed197b9216cb482eee4f5e4eb2579a5303f7
Bug: skia:12858
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/502303
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2022-01-31 21:17:40 +00:00

34 lines
1008 B
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 out_params_are_distinct_bhh(thread half& x, thread half& y);
bool _skOutParamHelper0_out_params_are_distinct_bhh(thread half& x, thread half&) {
half _var0;
half _var1;
bool _skResult = out_params_are_distinct_bhh(_var0, _var1);
x = _var0;
x = _var1;
return _skResult;
}
bool out_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_out_params_are_distinct_bhh(x, x) ? _uniforms.colorGreen : _uniforms.colorRed;
return _out;
}