493a9c0cbc
The test has been moved to shared/, since it's a valid test, but it is no longer related to inlining, as the inliner no longer attempts to inline functions with inouts at all. Also, one function here (outParameterIgnore) actually invoked undefined behavior and has been removed. According to the GLSL ES2 docs: "If a function does not write to an out parameter, the value of the actual parameter is undefined when the function returns." SkVM leaves the value unchanged, so SKSL_TEST_CPU would pass, but a GPU might clear it (and in fact, my GPU does). Change-Id: I77c77ed1354bc980344ec5c406992bd62015f5e5 Bug: skia:11919 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/499752 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
71 lines
2.3 KiB
Metal
71 lines
2.3 KiB
Metal
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
using namespace metal;
|
|
struct Uniforms {
|
|
half4 colorGreen;
|
|
};
|
|
struct Inputs {
|
|
};
|
|
struct Outputs {
|
|
half4 sk_FragColor [[color(0)]];
|
|
};
|
|
void outParameterWrite_vh4(Uniforms _uniforms, thread half4& x);
|
|
void _skOutParamHelper0_outParameterWrite_vh4(Uniforms _uniforms, thread half4& c) {
|
|
half4 _var0;
|
|
outParameterWrite_vh4(_uniforms, _var0);
|
|
c = _var0;
|
|
}
|
|
void inoutParameterWrite_vh4(thread half4& x);
|
|
void _skOutParamHelper1_inoutParameterWrite_vh4(thread half4& x) {
|
|
half4 _var0 = x;
|
|
inoutParameterWrite_vh4(_var0);
|
|
x = _var0;
|
|
}
|
|
void outParameterWrite_vh4(Uniforms _uniforms, thread half4& x);
|
|
void _skOutParamHelper2_outParameterWrite_vh4(Uniforms _uniforms, thread half4& c) {
|
|
half4 _var0;
|
|
outParameterWrite_vh4(_uniforms, _var0);
|
|
c = _var0;
|
|
}
|
|
void outParameterWriteIndirect_vh4(Uniforms _uniforms, thread half4& c);
|
|
void _skOutParamHelper3_outParameterWriteIndirect_vh4(Uniforms _uniforms, thread half4& c) {
|
|
half4 _var0;
|
|
outParameterWriteIndirect_vh4(_uniforms, _var0);
|
|
c = _var0;
|
|
}
|
|
void inoutParameterWrite_vh4(thread half4& x);
|
|
void _skOutParamHelper4_inoutParameterWrite_vh4(thread half4& c) {
|
|
half4 _var0 = c;
|
|
inoutParameterWrite_vh4(_var0);
|
|
c = _var0;
|
|
}
|
|
void inoutParameterWriteIndirect_vh4(thread half4& x);
|
|
void _skOutParamHelper5_inoutParameterWriteIndirect_vh4(thread half4& c) {
|
|
half4 _var0 = c;
|
|
inoutParameterWriteIndirect_vh4(_var0);
|
|
c = _var0;
|
|
}
|
|
void outParameterWrite_vh4(Uniforms _uniforms, thread half4& x) {
|
|
x = _uniforms.colorGreen;
|
|
}
|
|
void outParameterWriteIndirect_vh4(Uniforms _uniforms, thread half4& c) {
|
|
_skOutParamHelper0_outParameterWrite_vh4(_uniforms, c);
|
|
}
|
|
void inoutParameterWrite_vh4(thread half4& x) {
|
|
x *= x;
|
|
}
|
|
void inoutParameterWriteIndirect_vh4(thread half4& x) {
|
|
_skOutParamHelper1_inoutParameterWrite_vh4(x);
|
|
}
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
|
Outputs _out;
|
|
(void)_out;
|
|
half4 c;
|
|
_skOutParamHelper2_outParameterWrite_vh4(_uniforms, c);
|
|
_skOutParamHelper3_outParameterWriteIndirect_vh4(_uniforms, c);
|
|
_skOutParamHelper4_inoutParameterWrite_vh4(c);
|
|
_skOutParamHelper5_inoutParameterWriteIndirect_vh4(c);
|
|
_out.sk_FragColor = c;
|
|
return _out;
|
|
}
|