]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/bad_condition_type.glsl
Require conditions to be booleans
[libs/gl.git] / tests / glsl / bad_condition_type.glsl
diff --git a/tests/glsl/bad_condition_type.glsl b/tests/glsl/bad_condition_type.glsl
new file mode 100644 (file)
index 0000000..867d04e
--- /dev/null
@@ -0,0 +1,28 @@
+uniform vec3 light_dir[8];
+uniform int light_count;
+
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 position;
+layout(location=1) in vec3 normal;
+void main()
+{
+       out float light_intensity = 0.0;
+       if(light_count)
+       {
+               for(int i=light_count; i--; )
+                       light_intensity += dot(normal, light_dir[i]);
+       }
+       gl_Position = position;
+}
+
+#pragma MSP stage(fragment)
+layout(location=0) out vec4 frag_color;
+void main()
+{
+       frag_color = vec4(vec3(light_intensity), 1.0);
+}
+
+/* Expected error:
+<test>:10: Condition is not a boolean
+<test>:12: Loop condition is not a boolean
+*/