John Kessenich | 2f21fcc | 2015-06-17 16:15:09 +0000 | [diff] [blame] | 1 | #version 120
|
| 2 |
|
| 3 | uniform sampler2D sampler;
|
| 4 |
|
| 5 | vec4 v1 = vec4(2.0, 3.0, 5.0, 7.0);
|
| 6 | vec4 v2 = vec4(11.0, 13.0, 17.0, 19.0);
|
| 7 | vec4 v3 = vec4(23.0, 29.0, 31.0, 37.0);
|
| 8 | vec4 v4 = vec4(41.0, 43.0, 47.0, 53.0);
|
| 9 |
|
| 10 | struct str {
|
| 11 | int a;
|
| 12 | vec2 b[3];
|
| 13 | bool c;
|
| 14 | };
|
| 15 |
|
| 16 | void main()
|
| 17 | {
|
| 18 | mat4 m = mat4(v1, v2, v3, v4);
|
| 19 |
|
| 20 | mat4 mm = matrixCompMult(m, m);
|
| 21 | float f = mm[1].w; // should be 19 * 19 = 361
|
| 22 |
|
| 23 | // do a deep access to a spontaneous r-value
|
| 24 | float g = matrixCompMult(m, m)[2].y; // should be 29 * 29 = 841
|
| 25 |
|
| 26 | float h = str(1, vec2[3](vec2(2.0, 3.0), vec2(4.0, 5.0), vec2(6.0, 7.0)), true).b[1][1]; // should be 5.0
|
| 27 |
|
| 28 | float i = texture2D(sampler, vec2(0.5,0.5)).y;
|
| 29 |
|
| 30 | i += (i > 0.1 ? v1 : v2)[3];
|
| 31 |
|
| 32 | str t;
|
| 33 | i += (t = str(1, vec2[3](vec2(2.0, 3.0), vec2(4.0, 5.0), vec2(6.0, 7.0)), true)).b[2].y; // should be 7.0
|
| 34 |
|
| 35 | gl_FragColor = vec4(f, g, h, i);
|
| 36 | }
|