skia2/resources/sksl/inliner/TrivialArgumentsInlineDirectly.sksl

66 lines
1.4 KiB
Plaintext
Raw Normal View History

in half val;
uniform int ui;
uniform half4 uh4;
uniform bool b;
struct S {
half4 ah4[1];
half ah[1];
half4 h4;
half h;
};
half4 funcb(bool b) {
return b ? sk_FragColor.xxxx : sk_FragColor.yyyy;
}
half4 func1(half h) {
return h.xxxx;
}
half4 func2(half2 h2) {
return h2.xyxy;
}
half4 func3(half3 h3) {
return h3.xyzx;
}
half4 func4(half4 h4) {
return h4;
}
void main() {
S s;
s.ah4[0] = half4(val);
s.ah[0] = val;
s.h4 = half4(val);
s.h = val;
S as[1];
as[0].ah4[0] = half4(val);
// These expressions are considered "trivial" and will be cloned directly into the inlined
// function without a temporary variable.
sk_FragColor = funcb(sk_Caps.floatIs32Bits);
sk_FragColor = func1(+s.h);
sk_FragColor = funcb(b);
sk_FragColor = func2(s.ah4[0].yw);
sk_FragColor = func2(as[0].ah4[0].xy);
sk_FragColor = func3(s.h4.zzz);
sk_FragColor = func3(uh4.xyz);
sk_FragColor = func3(s.h.xxx);
sk_FragColor = func4(half4(s.h));
sk_FragColor = func4(s.ah4[0].xxxy);
sk_FragColor = func4(uh4);
// These expressions are considered "non-trivial" and will be placed in a temporary variable
// when inlining occurs.
sk_FragColor = funcb(!sk_Caps.floatIs32Bits);
sk_FragColor = func1(-s.h);
sk_FragColor = funcb(!b);
sk_FragColor = func2(s.ah4[ui].yw);
sk_FragColor = func3(s.h4.yyy + s.h4.zzz);
sk_FragColor = func4(s.h4.y001);
}