[Piglit] [PATCH 2/2] glsl-es-3.00: Verify that .length() returns a constant expression

Ian Romanick idr at freedesktop.org
Fri Nov 16 16:26:42 PST 2012


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 .../compiler/array-length-is-constant.vert         | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 tests/spec/glsl-es-3.00/compiler/array-length-is-constant.vert

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 0000000..7569270
--- /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];
+}
-- 
1.7.11.7



More information about the Piglit mailing list