[Piglit] [RFC PATCH] Test that in/out qualifiers are required when redeclaring gl_ClipDistance.

Paul Berry stereotype441 at gmail.com
Tue Oct 8 20:29:13 CEST 2013


Although it is not explicitly stated in the GLSL spec, all examples of
redeclaring built-in in/out variables (such as gl_ClipDistance)
include the "in" or "out" qualifier, so it seems like failure to do so
should cause a compile error.

At present:

- Mesa (as of commit a50c5f8) does not generate an error.

- The NVIDIA proprietary driver for Linux (version 313.18) does not
  generate an error; however, if gl_ClipDistance is redeclared in the
  fragment shader without specifying the "in" keyword, it fails to
  work properly.
---
 .../clip-distance-redeclare-without-inout.frag      | 21 +++++++++++++++++++++
 .../clip-distance-redeclare-without-inout.vert      | 21 +++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.frag
 create mode 100644 tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.vert

diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.frag b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.frag
new file mode 100644
index 0000000..60f0650
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.frag
@@ -0,0 +1,21 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * check_link: true
+ * [end config]
+ *
+ * Although it is not explicitly stated in the GLSL spec, in all
+ * examples, redeclarations of built-in variables (such as
+ * gl_ClipDistance) preserve the in/out qualifiers.
+ *
+ * This test verifies that a shader is rejected if it tries to
+ * redeclare gl_ClipDistance without an in/out qualifier.
+ */
+#version 130
+
+float gl_ClipDistance[3];
+
+void main()
+{
+  gl_FragColor = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.vert b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.vert
new file mode 100644
index 0000000..d385cc7
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/clipping/clip-distance-redeclare-without-inout.vert
@@ -0,0 +1,21 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * check_link: true
+ * [end config]
+ *
+ * Although it is not explicitly stated in the GLSL spec, in all
+ * examples, redeclarations of built-in variables (such as
+ * gl_ClipDistance) preserve the in/out qualifiers.
+ *
+ * This test verifies that a shader is rejected if it tries to
+ * redeclare gl_ClipDistance without an in/out qualifier.
+ */
+#version 130
+
+float gl_ClipDistance[3];
+
+void main()
+{
+  gl_Position = vec4(0.0);
+}
-- 
1.8.4



More information about the Piglit mailing list