summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2012-11-16 16:26:08 -0800
committerIan Romanick <ian.d.romanick@intel.com>2012-11-26 14:21:50 -0800
commit13205de1384b918483fdda0d6a8d9fecb1bf4027 (patch)
treed97b003e324db895bc5f9ac85a405bda29ed4bf2 /tests
parenta1515bd2c785bac4d0f08e9f09fec1eba7321d7c (diff)
glsl-es-3.00: Verify that .length() returns a constant expression
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/spec/glsl-es-3.00/compiler/array-length-is-constant.vert28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/spec/glsl-es-3.00/compiler/array-length-is-constant.vert b/tests/spec/glsl-es-3.00/compiler/array-length-is-constant.vert
new file mode 100644
index 00000000..7569270a
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/array-length-is-constant.vert
@@ -0,0 +1,28 @@
+#version 300 es
+
+/* [config]
+ * expect_result: pass
+ * glsl_version: 3.00
+ * [end config]
+ *
+ * Page 35 of the OpenGL ES Shading Language 3.00 spec says:
+ *
+ * "Arrays have a fixed number of elements. This can be obtained
+ * by using the length method:
+ *
+ * a.length();
+ * // returns 5 for the above declarations
+ *
+ * The return value is a constant signed integral expression. The
+ * precision is determined using the same rules as for literal
+ * integers."
+ */
+
+uniform vec4 a[7];
+uniform vec4 b[a.length()];
+uniform int i;
+
+void main()
+{
+ gl_Position = a[i] + b[i];
+}