[Piglit] [PATCH 3/4] glsl-1.30: Verify that gl_ClipDistance cannot be redeclared to change qualifier or type
Ian Romanick
idr at freedesktop.org
Fri Oct 5 23:45:51 UTC 2018
From: Ian Romanick <ian.d.romanick at intel.com>
glslangValidator rejects all of the shaders that try to change the
qualifier with errors like:
ERROR: 0:8: 'redeclaration' : cannot change qualification of gl_ClipDistance
Mesa currently allows all of them to compile. Closed-source drivers
have not been tested.
glslangValidator rejects the shaders that try to change the type with:
ERROR: 0:8: 'gl_ClipDistance' : redeclaration of array with a different element type
Mesa currently rejects these with a somewhat less helpful error message.
Closed-source drivers have not been tested.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Andrii Simiklit <andrii.simiklit at globallogic.com>
---
.../compiler/redeclarations/gl_ClipDistance-as-global.frag | 13 +++++++++++++
.../compiler/redeclarations/gl_ClipDistance-as-global.vert | 13 +++++++++++++
.../compiler/redeclarations/gl_ClipDistance-as-in-vec2.frag | 13 +++++++++++++
.../compiler/redeclarations/gl_ClipDistance-as-in.frag | 13 +++++++++++++
.../redeclarations/gl_ClipDistance-as-out-vec2.vert | 13 +++++++++++++
.../compiler/redeclarations/gl_ClipDistance-as-out.frag | 13 +++++++++++++
.../compiler/redeclarations/gl_ClipDistance-as-out.vert | 13 +++++++++++++
.../compiler/redeclarations/gl_ClipDistance-as-uniform.frag | 13 +++++++++++++
.../compiler/redeclarations/gl_ClipDistance-as-uniform.vert | 13 +++++++++++++
9 files changed, 117 insertions(+)
create mode 100644 tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-global.frag
create mode 100644 tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-global.vert
create mode 100644 tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-in-vec2.frag
create mode 100644 tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-in.frag
create mode 100644 tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-out-vec2.vert
create mode 100644 tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-out.frag
create mode 100644 tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-out.vert
create mode 100644 tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-uniform.frag
create mode 100644 tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-uniform.vert
diff --git a/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-global.frag b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-global.frag
new file mode 100644
index 000000000..fa110729d
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-global.frag
@@ -0,0 +1,13 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * [end config]
+ */
+#version 130
+
+float gl_ClipDistance[2];
+
+void main()
+{
+ gl_FragColor = vec4(0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-global.vert b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-global.vert
new file mode 100644
index 000000000..0ad68c03d
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-global.vert
@@ -0,0 +1,13 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * [end config]
+ */
+#version 130
+
+float gl_ClipDistance[2];
+
+void main()
+{
+ gl_Position = gl_Vertex;
+}
diff --git a/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-in-vec2.frag b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-in-vec2.frag
new file mode 100644
index 000000000..4ce080b38
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-in-vec2.frag
@@ -0,0 +1,13 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * [end config]
+ */
+#version 130
+
+in vec2 gl_ClipDistance[2];
+
+void main()
+{
+ gl_FragColor = vec4(0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-in.frag b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-in.frag
new file mode 100644
index 000000000..bf6a25a58
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-in.frag
@@ -0,0 +1,13 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.30
+ * [end config]
+ */
+#version 130
+
+in float gl_ClipDistance[2];
+
+void main()
+{
+ gl_FragColor = vec4(0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-out-vec2.vert b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-out-vec2.vert
new file mode 100644
index 000000000..2bd667f55
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-out-vec2.vert
@@ -0,0 +1,13 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * [end config]
+ */
+#version 130
+
+out vec2 gl_ClipDistance[2];
+
+void main()
+{
+ gl_Position = gl_Vertex;
+}
diff --git a/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-out.frag b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-out.frag
new file mode 100644
index 000000000..d0e7ec508
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-out.frag
@@ -0,0 +1,13 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * [end config]
+ */
+#version 130
+
+out float gl_ClipDistance[2];
+
+void main()
+{
+ gl_FragColor = vec4(0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-out.vert b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-out.vert
new file mode 100644
index 000000000..6d7dee0ab
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-out.vert
@@ -0,0 +1,13 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.30
+ * [end config]
+ */
+#version 130
+
+out float gl_ClipDistance[2];
+
+void main()
+{
+ gl_Position = gl_Vertex;
+}
diff --git a/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-uniform.frag b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-uniform.frag
new file mode 100644
index 000000000..f36c7f69c
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-uniform.frag
@@ -0,0 +1,13 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * [end config]
+ */
+#version 130
+
+uniform float gl_ClipDistance[2];
+
+void main()
+{
+ gl_FragColor = vec4(0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-uniform.vert b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-uniform.vert
new file mode 100644
index 000000000..59e9501c9
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/redeclarations/gl_ClipDistance-as-uniform.vert
@@ -0,0 +1,13 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.30
+ * [end config]
+ */
+#version 130
+
+uniform float gl_ClipDistance[2];
+
+void main()
+{
+ gl_Position = gl_Vertex;
+}
--
2.14.4
More information about the Piglit
mailing list