You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
70 lines
1.6 KiB
70 lines
1.6 KiB
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(float2 coords) {
|
|
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;
|
|
}
|