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>
42 lines
853 B
Plaintext
42 lines
853 B
Plaintext
uniform half4 colorGreen;
|
|
|
|
inline void outParameterWrite(out half4 x) {
|
|
x = colorGreen;
|
|
}
|
|
|
|
inline void outParameterWriteIndirect(out half4 c) {
|
|
outParameterWrite(c);
|
|
}
|
|
|
|
inline void inoutParameterWrite(inout half4 x) {
|
|
x *= x;
|
|
}
|
|
|
|
inline void inoutParameterWriteIndirect(inout half4 x) {
|
|
inoutParameterWrite(x);
|
|
}
|
|
|
|
inline void inoutParameterRead(inout half4 x) {
|
|
half4 scratch = x * x;
|
|
}
|
|
|
|
inline void inoutParameterIgnore(inout half4 x) {
|
|
half4 scratch = colorGreen * colorGreen;
|
|
}
|
|
|
|
half4 main(float2 coords) {
|
|
half4 c;
|
|
|
|
// These functions write to their `out` param.
|
|
outParameterWrite(c);
|
|
outParameterWriteIndirect(c);
|
|
inoutParameterWrite(c);
|
|
inoutParameterWriteIndirect(c);
|
|
|
|
// These functions don't write to their `out` param.
|
|
inoutParameterRead(c);
|
|
inoutParameterIgnore(c);
|
|
|
|
return c;
|
|
}
|