74410023ac
Functions which don't write to their out params should be safe to inline, but we currently don't recognize this. Change-Id: I753e48067c7be4473675ef6c95e61af17dc5ae41 Bug: skia:12636 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470298 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
39 lines
905 B
Plaintext
39 lines
905 B
Plaintext
uniform half4 colorGreen;
|
|
|
|
inline void outParameterWrite(out half4 x) {
|
|
x = colorGreen;
|
|
}
|
|
|
|
inline void inoutParameterWrite(inout half4 x) {
|
|
x *= x;
|
|
}
|
|
|
|
inline void inoutParameterRead(inout half4 x) {
|
|
half4 scratch = x * x;
|
|
}
|
|
|
|
inline void inoutParameterIgnore(inout half4 x) {
|
|
half4 scratch = colorGreen * colorGreen;
|
|
}
|
|
|
|
inline void outParameterIgnore(out half4 x) {
|
|
half4 scratch = colorGreen * colorGreen;
|
|
}
|
|
|
|
// We don't inline functions that write to out parameters. (skia:11326)
|
|
half4 main(float2 coords) {
|
|
half4 c;
|
|
|
|
// These calls are ineligible for inlining, because they write to their `out` param.
|
|
outParameterWrite(c);
|
|
inoutParameterWrite(c);
|
|
|
|
// TODO(skia:12636): These calls are eligible for inlining, because they don't write to their
|
|
// `out` param.
|
|
inoutParameterRead(c);
|
|
inoutParameterIgnore(c);
|
|
outParameterIgnore(c);
|
|
|
|
return c;
|
|
}
|