skia2/resources/sksl/inliner/TrivialArgumentsInlineDirectly.sksl
Joe Gregorio 67baf2dd48 Revert "Add coords parameter to all .sksl test files used as runtime effects"
This reverts commit 22dcb5fd7e.

Reason for revert: Lot's of red Android and Win bots.

Original change's description:
> Add coords parameter to all .sksl test files used as runtime effects
>
> Convert to use the newer MakeForShader factory, which requires this.
>
> Change-Id: Ifaf6054054027c78f3f3fe15596e435e0f79b877
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399336
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: John Stiles <johnstiles@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: I0fa844c6cf985d16e72c7f26aa217752612dcfc1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401077
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
2021-04-26 19:40:30 +00:00

70 lines
1.6 KiB
Plaintext

uniform half4 colorGreen;
uniform half unknownInput;
struct S {
half4 ah4[1];
half ah[1];
half4 h4;
half h;
};
// Each helper function needs to reference the variable multiple times, because if it's only read
// from once, it is inlined directly whether or not it is trivial.
half4 funcb(bool b) {
return half4(b, b, b, !b);
}
half4 func1(half h) {
return h.xxxx * h.xxxx;
}
half4 func2(half2 h2) {
return h2.xyxy * h2.yxyx;
}
half4 func3(half3 h3) {
return h3.xyzx * h3.xyzx;
}
half4 func4(half4 h4) {
return h4 * h4;
}
half4 main() {
S s;
s.ah4[0] = half4(unknownInput);
s.ah[0] = unknownInput;
s.h4 = half4(unknownInput);
s.h = unknownInput;
S as[1];
as[0].ah4[0] = half4(unknownInput);
bool b = bool(unknownInput);
int i = int(unknownInput);
// These expressions are considered "trivial" and will be cloned directly into the inlined
// function without a temporary variable.
half4 var;
var = func1(+s.h);
var = funcb(b);
var = func2(s.ah4[0].yw);
var = func2(as[0].ah4[0].xy);
var = func3(s.h4.zzz);
var = func3(colorGreen.xyz);
var = func3(s.h.xxx);
var = func4(half4(s.h));
var = func4(s.ah4[0].xxxy);
var = func4(colorGreen);
// These expressions are considered "non-trivial" and will be placed in a temporary variable
// when inlining occurs.
var = func1(-s.h);
var = funcb(!b);
// var = func2(as[i].h4.yw); // indexing by non-constant expressions disallowed in ES2
var = func3(s.h4.yyy + s.h4.zzz);
var = func4(s.h4.y001);
return colorGreen;
}