]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/expression_inline_iteration.glsl
Handle OpPhi when specializing SPIR-V modules
[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 // Target API: Vulkan
20
21 /* Expected output: vertex
22 layout(location=0) in vec4 position;
23 layout(location=1) in vec3 direction;
24 void main()
25 {
26         vec3 p = position.xyz;
27         int step = -1;
28         for(int i=0; i<10; ++i)
29         {
30                 p += direction*2.0;
31                 if(p.z<0.0)
32                         break;
33                 step = i;
34         }
35         gl_Position = position+vec4(float(step), 0.0, 0.0, 0.0);
36 }
37 */