]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/expression_inline_iteration.glsl
Fix a test case and add a couple more
[libs/gl.git] / tests / glsl / expression_inline_iteration.glsl
1 #pragma MSP stage(vertex)
2 layout(location=0) in vec4 position;
3 layout(location=1) in vec3 direction;
4 void main()
5 {
6         vec3 p = position.xyz;
7         int step = -1;
8         for(int i=0; i<10; ++i)
9         {
10                 float scale = 2.0;
11                 p += direction*scale;
12                 if(p.z<0.0)
13                         break;
14                 step = i;
15         }
16         gl_Position = position+vec4(step, 0.0, 0.0, 0.0);
17 }
18
19 /* Expected output: vertex
20 layout(location=0) in vec4 position;
21 layout(location=1) in vec3 direction;
22 void main()
23 {
24         vec3 p = position.xyz;
25         int step = -1;
26         for(int i=0; i<10; ++i)
27         {
28                 p += direction*2.0;
29                 if(p.z<0.0)
30                         break;
31                 step = i;
32         }
33         gl_Position = position+vec4(step, 0.0, 0.0, 0.0);
34 }
35 */