[Piglit] [PATCH] glsl-1.00: Add testcases from the spec about redeclarations.

Eric Anholt eric at anholt.net
Wed May 3 22:22:12 UTC 2017


Catches a regression in my recent redeclaration patch series
(allowed-2) and failure I was trying to fix (disallowed-2).
---
 .../compiler/redeclaration-allowed-1.vert          | 26 ++++++++++++++++++++++
 .../compiler/redeclaration-allowed-2.vert          | 23 +++++++++++++++++++
 .../compiler/redeclaration-disallowed-1.vert       | 26 ++++++++++++++++++++++
 .../compiler/redeclaration-disallowed-2.vert       | 19 ++++++++++++++++
 .../compiler/redeclaration-disallowed-3.vert       | 19 ++++++++++++++++
 .../compiler/redeclaration-disallowed-4.vert       | 19 ++++++++++++++++
 .../compiler/redeclaration-disallowed-5.vert       | 19 ++++++++++++++++
 .../compiler/redeclaration-disallowed-6.vert       | 19 ++++++++++++++++
 8 files changed, 170 insertions(+)
 create mode 100644 tests/spec/glsl-es-1.00/compiler/redeclaration-allowed-1.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/redeclaration-allowed-2.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-1.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-2.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-3.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-4.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-5.vert
 create mode 100644 tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-6.vert

diff --git a/tests/spec/glsl-es-1.00/compiler/redeclaration-allowed-1.vert b/tests/spec/glsl-es-1.00/compiler/redeclaration-allowed-1.vert
new file mode 100644
index 000000000000..7ca5677315e7
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/redeclaration-allowed-1.vert
@@ -0,0 +1,26 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.00
+// [end config]
+
+// See section 4.2.7 "Redeclarations and Redefinitions Within the Same
+// Scope"
+
+#version 100
+
+precision mediump float;
+
+int f(int a)
+{
+	return a;
+}
+
+float f(float a)
+{
+	return a;
+}
+
+void main()
+{
+	gl_Position = vec4(f(1.0)) + vec4(f(1));
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/redeclaration-allowed-2.vert b/tests/spec/glsl-es-1.00/compiler/redeclaration-allowed-2.vert
new file mode 100644
index 000000000000..1f6c0f851103
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/redeclaration-allowed-2.vert
@@ -0,0 +1,23 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.00
+// [end config]
+
+// See Section 4.2.7 "Redeclarations and Redefinitions Within the Same
+// Scope"
+
+#version 100
+
+precision mediump float;
+
+int f(int a);
+
+int f(int a)
+{
+	return a;
+}
+
+void main()
+{
+	gl_Position = vec4(f(1));
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-1.vert b/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-1.vert
new file mode 100644
index 000000000000..a5c4e1e7290a
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-1.vert
@@ -0,0 +1,26 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.00
+// [end config]
+
+// See Section 4.2.7 "Redeclarations and Redefinitions Within the Same
+// Scope"
+
+#version 100
+
+precision mediump float;
+
+int f(int a)
+{
+	return a;
+}
+
+int f(int a)
+{
+	return a;
+}
+
+void main()
+{
+	gl_Position = vec4(f(1));
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-2.vert b/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-2.vert
new file mode 100644
index 000000000000..779475a49168
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-2.vert
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.00
+// [end config]
+
+// See Section 4.2.7 "Redeclarations and Redefinitions Within the Same
+// Scope"
+
+#version 100
+
+precision mediump float;
+
+int f(int a);
+int f(int a);
+
+void main()
+{
+	gl_Position = vec4(1.0);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-3.vert b/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-3.vert
new file mode 100644
index 000000000000..2422abdd94d2
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-3.vert
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.00
+// [end config]
+
+// See Section 4.2.7 "Redeclarations and Redefinitions Within the Same
+// Scope"
+
+#version 100
+
+precision mediump float;
+
+int f(int a);
+struct f { int x; };
+
+void main()
+{
+	gl_Position = vec4(1.0);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-4.vert b/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-4.vert
new file mode 100644
index 000000000000..44d0d160be0a
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-4.vert
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.00
+// [end config]
+
+// See Section 4.2.7 "Redeclarations and Redefinitions Within the Same
+// Scope"
+
+#version 100
+
+precision mediump float;
+
+struct f { int x; };
+int f;
+
+void main()
+{
+	gl_Position = vec4(1.0);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-5.vert b/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-5.vert
new file mode 100644
index 000000000000..68617b4eb2a3
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-5.vert
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.00
+// [end config]
+
+// See Section 4.2.7 "Redeclarations and Redefinitions Within the Same
+// Scope"
+
+#version 100
+
+precision mediump float;
+
+int a[3];
+int a[3];
+
+void main()
+{
+	gl_Position = vec4(1.0);
+}
diff --git a/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-6.vert b/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-6.vert
new file mode 100644
index 000000000000..d11db9d36f08
--- /dev/null
+++ b/tests/spec/glsl-es-1.00/compiler/redeclaration-disallowed-6.vert
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.00
+// [end config]
+
+// See Section 4.2.7 "Redeclarations and Redefinitions Within the Same
+// Scope"
+
+#version 100
+
+precision mediump float;
+
+int x;
+int x;
+
+void main()
+{
+	gl_Position = vec4(1.0);
+}
-- 
2.11.0



More information about the Piglit mailing list