[Piglit] [PATCH 6/6] Clip distance: Test error conditions for implicitly sized gl_ClipDistance.
Paul Berry
stereotype441 at gmail.com
Sun Sep 4 11:34:33 PDT 2011
These tests verify that it is illegal to use the .length() method on
gl_ClipDistance when it is implicitly sized, or to access it using an
index that is not a constant.
---
.../clipping/clip-distance-implicit-length.vert | 23 +++++++++++++++++++
.../clip-distance-implicit-nonconst-access.vert | 24 ++++++++++++++++++++
2 files changed, 47 insertions(+), 0 deletions(-)
create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-length.vert
create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-nonconst-access.vert
diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-length.vert b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-length.vert
new file mode 100644
index 0000000..acbdfb7
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-length.vert
@@ -0,0 +1,23 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * [end config]
+ *
+ * From the GLSL 1.30 spec section 7.1 (Vertex Shader Special
+ * Variables):
+ *
+ * The gl_ClipDistance array is predeclared as unsized and must be
+ * sized by the shader either redeclaring it with a size or indexing
+ * it only with integral constant expressions.
+ *
+ * This test verifies that gl_ClipDistance is predeclared as unsized
+ * by attempting to take its length, an operation that is not allowed
+ * on unsized arrays.
+ */
+#version 130
+
+void main()
+{
+ gl_Position = vec4(gl_ClipDistance.length());
+}
+
diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-nonconst-access.vert b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-nonconst-access.vert
new file mode 100644
index 0000000..69418dd
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-implicit-nonconst-access.vert
@@ -0,0 +1,24 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * [end config]
+ *
+ * From the GLSL 1.30 spec section 7.1 (Vertex Shader Special
+ * Variables):
+ *
+ * The gl_ClipDistance array is predeclared as unsized and must be
+ * sized by the shader either redeclaring it with a size or indexing
+ * it only with integral constant expressions.
+ *
+ * This test verifies that gl_ClipDistance is predeclared as unsized
+ * by attempting to access it using a non-constant index, an operation
+ * that is not allowed on unsized arrays.
+ */
+#version 130
+uniform int index;
+
+void main()
+{
+ gl_Position = vec4(0.0);
+ gl_ClipDistance[index] = 0.0;
+}
--
1.7.6
More information about the Piglit
mailing list