2021-01-27 18:53:43 +00:00
|
|
|
|
|
|
|
out vec4 sk_FragColor;
|
|
|
|
uniform vec4 colorRed;
|
|
|
|
uniform vec4 colorGreen;
|
|
|
|
struct S {
|
|
|
|
float x;
|
|
|
|
int y;
|
|
|
|
};
|
2021-03-22 15:43:11 +00:00
|
|
|
S returns_a_struct_S() {
|
2021-01-27 18:53:43 +00:00
|
|
|
S s;
|
|
|
|
s.x = 1.0;
|
|
|
|
s.y = 2;
|
|
|
|
return s;
|
|
|
|
}
|
2021-03-22 15:43:11 +00:00
|
|
|
float accepts_a_struct_fS(S s) {
|
2021-01-27 18:53:43 +00:00
|
|
|
return s.x + float(s.y);
|
|
|
|
}
|
2021-03-22 15:43:11 +00:00
|
|
|
void modifies_a_struct_vS(inout S s) {
|
2021-01-27 18:53:43 +00:00
|
|
|
s.x++;
|
|
|
|
s.y++;
|
|
|
|
}
|
|
|
|
vec4 main() {
|
2021-03-22 15:43:11 +00:00
|
|
|
S s = returns_a_struct_S();
|
|
|
|
float x = accepts_a_struct_fS(s);
|
|
|
|
modifies_a_struct_vS(s);
|
2021-01-27 18:53:43 +00:00
|
|
|
bool valid = (x == 3.0 && s.x == 2.0) && s.y == 3;
|
|
|
|
return valid ? colorGreen : colorRed;
|
|
|
|
}
|