[Piglit] [PATCH 4/4] glsl-1.50: Verify that gl_ClipDistance cannot be redeclared to change qualifier or type
Ian Romanick
idr at freedesktop.org
Fri Oct 5 23:45:52 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.
NOTE: The lone .vert test is here because vertex shader array input were
added in GLSL 1.50.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Cc: Andrii Simiklit <andrii.simiklit at globallogic.com>
---
.../redeclarations/gl_ClipDistance-as-global.geom | 17 +++++++++++++++++
.../compiler/redeclarations/gl_ClipDistance-as-in.geom | 17 +++++++++++++++++
.../compiler/redeclarations/gl_ClipDistance-as-in.vert | 13 +++++++++++++
.../redeclarations/gl_ClipDistance-as-out-vec2.geom | 17 +++++++++++++++++
.../compiler/redeclarations/gl_ClipDistance-as-out.geom | 17 +++++++++++++++++
.../redeclarations/gl_ClipDistance-as-uniform.geom | 17 +++++++++++++++++
6 files changed, 98 insertions(+)
create mode 100644 tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-global.geom
create mode 100644 tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-in.geom
create mode 100644 tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-in.vert
create mode 100644 tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-out-vec2.geom
create mode 100644 tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-out.geom
create mode 100644 tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-uniform.geom
diff --git a/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-global.geom b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-global.geom
new file mode 100644
index 000000000..27fb48b7b
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-global.geom
@@ -0,0 +1,17 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.50
+ * [end config]
+ */
+#version 150
+
+layout(points) in;
+layout(points, max_vertices = 1) out;
+
+float gl_ClipDistance[2];
+
+void main()
+{
+ gl_Position = vec4(0);
+ EmitVertex();
+}
diff --git a/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-in.geom b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-in.geom
new file mode 100644
index 000000000..abbb9551c
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-in.geom
@@ -0,0 +1,17 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.50
+ * [end config]
+ */
+#version 150
+
+layout(points) in;
+layout(points, max_vertices = 1) out;
+
+in float gl_ClipDistance[2];
+
+void main()
+{
+ gl_Position = vec4(0);
+ EmitVertex();
+}
diff --git a/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-in.vert b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-in.vert
new file mode 100644
index 000000000..a2b671d28
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-in.vert
@@ -0,0 +1,13 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.50
+ * [end config]
+ */
+#version 150
+
+in float gl_ClipDistance[2];
+
+void main()
+{
+ gl_Position = gl_Vertex;
+}
diff --git a/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-out-vec2.geom b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-out-vec2.geom
new file mode 100644
index 000000000..680d44d4d
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-out-vec2.geom
@@ -0,0 +1,17 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.50
+ * [end config]
+ */
+#version 150
+
+layout(points) in;
+layout(points, max_vertices = 1) out;
+
+out vec2 gl_ClipDistance[2];
+
+void main()
+{
+ gl_Position = vec4(0);
+ EmitVertex();
+}
diff --git a/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-out.geom b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-out.geom
new file mode 100644
index 000000000..54e3ccc2f
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-out.geom
@@ -0,0 +1,17 @@
+/* [config]
+ * expect_result: pass
+ * glsl_version: 1.50
+ * [end config]
+ */
+#version 150
+
+layout(points) in;
+layout(points, max_vertices = 1) out;
+
+out float gl_ClipDistance[2];
+
+void main()
+{
+ gl_Position = vec4(0);
+ EmitVertex();
+}
diff --git a/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-uniform.geom b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-uniform.geom
new file mode 100644
index 000000000..e0c550edd
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/redeclarations/gl_ClipDistance-as-uniform.geom
@@ -0,0 +1,17 @@
+/* [config]
+ * expect_result: fail
+ * glsl_version: 1.50
+ * [end config]
+ */
+#version 150
+
+layout(points) in;
+layout(points, max_vertices = 1) out;
+
+uniform float gl_ClipDistance[2];
+
+void main()
+{
+ gl_Position = vec4(0);
+ EmitVertex();
+}
--
2.14.4
More information about the Piglit
mailing list