]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/dead_loop_removal.glsl
Check the flat qualifier from the correct member
[libs/gl.git] / tests / glsl / dead_loop_removal.glsl
1 const int n_lights = 0;
2 struct LightParams
3 {
4         vec3 direction;
5         vec3 color;
6 };
7 uniform LightParams lights[n_lights];
8 uniform vec3 ambient;
9 uniform mat4 model_matrix;
10 uniform mat4 vp_matrix;
11
12 #pragma MSP stage(vertex)
13 layout(location=0) in vec4 position;
14 layout(location=1) in vec3 normal;
15 void main()
16 {
17         out vec3 world_normal = mat3(model_matrix)*normal;
18         gl_Position = vp_matrix*model_matrix*position;
19 }
20
21 #pragma MSP stage(fragment)
22 layout(location=0) out vec4 frag_color;
23 void main()
24 {
25         vec3 color = ambient;
26         for(int i=0; i<n_lights; ++i)
27                 color += max(dot(normalize(world_normal), lights[i].direction), 0.0)*lights[i].color;
28         frag_color = vec4(color, 1.0);
29 }
30
31 // Target API: OpenGL
32
33 /* Expected output: vertex
34 layout(location=0) uniform mat4 model_matrix;
35 layout(location=4) uniform mat4 vp_matrix;
36 layout(location=0) in vec4 position;
37 void main()
38 {
39   gl_Position = vp_matrix*model_matrix*position;
40   gl_Position.z = gl_Position.z*2.0-gl_Position.w;
41 }
42 */
43
44 /* Expected output: fragment
45 layout(location=8) uniform vec3 ambient;
46 layout(location=0) out vec4 frag_color;
47 void main()
48 {
49   frag_color = vec4(ambient, 1.0);
50 }
51 */