]> git.tdb.fi Git - libs/gl.git/blob - tests/glsl/bad_condition_type.glsl
Require conditions to be booleans
[libs/gl.git] / tests / glsl / bad_condition_type.glsl
1 uniform vec3 light_dir[8];
2 uniform int light_count;
3
4 #pragma MSP stage(vertex)
5 layout(location=0) in vec4 position;
6 layout(location=1) in vec3 normal;
7 void main()
8 {
9         out float light_intensity = 0.0;
10         if(light_count)
11         {
12                 for(int i=light_count; i--; )
13                         light_intensity += dot(normal, light_dir[i]);
14         }
15         gl_Position = position;
16 }
17
18 #pragma MSP stage(fragment)
19 layout(location=0) out vec4 frag_color;
20 void main()
21 {
22         frag_color = vec4(vec3(light_intensity), 1.0);
23 }
24
25 /* Expected error:
26 <test>:10: Condition is not a boolean
27 <test>:12: Loop condition is not a boolean
28 */