John Kessenich | 2f21fcc | 2015-06-17 16:15:09 +0000 | [diff] [blame] | 1 | #version 140
|
| 2 |
|
| 3 | void main()
|
| 4 | {
|
| 5 | struct s {
|
| 6 | float y[5];
|
| 7 | } str;
|
| 8 |
|
| 9 | float t;
|
| 10 | int index = 5; // all indexing is 4
|
| 11 |
|
| 12 | str.y[4] = 2.0; // 2.0
|
| 13 | t = ++str.y[--index]; // 3.0
|
| 14 | str.y[4] += t; // 6.0
|
| 15 | t = str.y[4]--; // 5.0 (t = 6.0)
|
| 16 | str.y[index++] += t; // 11.0
|
| 17 | --str.y[--index]; // 10.0
|
| 18 |
|
| 19 | float x = str.y[4];
|
| 20 | ++x;
|
| 21 | --x;
|
| 22 | x++;
|
| 23 | x--;
|
| 24 |
|
| 25 | // x is 10.0
|
| 26 |
|
| 27 | float y = x * ++x; // 10 * 11
|
| 28 | float z = y * x--; // 110 * 11
|
| 29 |
|
| 30 | // x is 10.0
|
| 31 | // z is 1210.0
|
| 32 |
|
| 33 | vec4 v = vec4(1.0, 2.0, 3.0, 4.0);
|
| 34 | v.y = v.z--; // (1,3,2,4)
|
| 35 | v.x = --v.w; // (3,3,2,3)
|
| 36 |
|
| 37 | gl_FragColor = z * v;// (3630.0, 3630.0, 2420.0, 3630.0)
|
| 38 | }
|