• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1uniform half4 colorGreen;
2
3inline void outParameterWrite(out half4 x) {
4    x = colorGreen;
5}
6
7inline void outParameterWriteIndirect(out half4 c) {
8    outParameterWrite(c);
9}
10
11inline void inoutParameterWrite(inout half4 x) {
12    x *= x;
13}
14
15inline void inoutParameterWriteIndirect(inout half4 x) {
16    inoutParameterWrite(x);
17}
18
19inline void inoutParameterRead(inout half4 x) {
20    half4 scratch = x * x;
21}
22
23inline void inoutParameterIgnore(inout half4 x) {
24    half4 scratch = colorGreen * colorGreen;
25}
26
27inline void outParameterIgnore(out half4 x) {
28    half4 scratch = colorGreen * colorGreen;
29}
30
31// We don't inline functions that write to out parameters. (skia:11326)
32half4 main(float2 coords) {
33    half4 c;
34
35    // These calls are ineligible for inlining, because they write to their `out` param.
36    outParameterWrite(c);
37    outParameterWriteIndirect(c);
38    inoutParameterWrite(c);
39    inoutParameterWriteIndirect(c);
40
41    // These calls are eligible for inlining, because they don't write to their `out` param.
42    inoutParameterRead(c);
43    inoutParameterIgnore(c);
44    outParameterIgnore(c);
45
46    return c;
47}
48