[Piglit] [PATCH 1/2] glsl-es-3.00: Verify that .length() returns a signed integer

Ian Romanick idr at freedesktop.org
Fri Nov 16 16:26:41 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-not-float.vert        | 27 ++++++++++++++++++++++
 .../compiler/array-length-is-not-unsigned-int.vert | 27 ++++++++++++++++++++++
 .../compiler/array-length-is-signed-int.vert       | 27 ++++++++++++++++++++++
 3 files changed, 81 insertions(+)
 create mode 100644 tests/spec/glsl-es-3.00/compiler/array-length-is-not-float.vert
 create mode 100644 tests/spec/glsl-es-3.00/compiler/array-length-is-not-unsigned-int.vert
 create mode 100644 tests/spec/glsl-es-3.00/compiler/array-length-is-signed-int.vert

diff --git a/tests/spec/glsl-es-3.00/compiler/array-length-is-not-float.vert b/tests/spec/glsl-es-3.00/compiler/array-length-is-not-float.vert
new file mode 100644
index 0000000..d529985
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/array-length-is-not-float.vert
@@ -0,0 +1,27 @@
+#version 300 es
+
+/* [config]
+ * expect_result: fail
+ * 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 int i;
+
+void main()
+{
+  gl_Position = vec4(a[i].x + a.length());
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/array-length-is-not-unsigned-int.vert b/tests/spec/glsl-es-3.00/compiler/array-length-is-not-unsigned-int.vert
new file mode 100644
index 0000000..56be010
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/array-length-is-not-unsigned-int.vert
@@ -0,0 +1,27 @@
+#version 300 es
+
+/* [config]
+ * expect_result: fail
+ * 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 int i;
+
+void main()
+{
+  gl_Position = vec4(uint(a[i].x) + a.length());
+}
diff --git a/tests/spec/glsl-es-3.00/compiler/array-length-is-signed-int.vert b/tests/spec/glsl-es-3.00/compiler/array-length-is-signed-int.vert
new file mode 100644
index 0000000..4dee5e8
--- /dev/null
+++ b/tests/spec/glsl-es-3.00/compiler/array-length-is-signed-int.vert
@@ -0,0 +1,27 @@
+#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 int i;
+
+void main()
+{
+  gl_Position = vec4(int(a[i].x) + a.length());
+}
-- 
1.7.11.7



More information about the Piglit mailing list