]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/constant_expressions.glsl
Check that non-constant data is not accessed from constant expressions
[libs/gl.git] / tests / glsl / constant_expressions.glsl
diff --git a/tests/glsl/constant_expressions.glsl b/tests/glsl/constant_expressions.glsl
new file mode 100644 (file)
index 0000000..90eab78
--- /dev/null
@@ -0,0 +1,15 @@
+uniform int n_lights;
+uniform vec3 light_dir[n_lights];
+
+#pragma MSP stage(vertex)
+layout(location=0) in vec4 position;
+const bool lower_half = position.y<0;
+void main()
+{
+       gl_Position = position;
+}
+
+/* Expected error:
+<test>:2: Reference to non-constant variable 'n_lights' in a constant expression
+<test>:6: Reference to non-constant variable 'position' in a constant expression
+*/