[Piglit] [PATCH 4/4] More tests for vs-fs interface block matching rules.

Paul Berry stereotype441 at gmail.com
Wed Oct 30 22:27:59 CET 2013


Note: as of Mesa 5cb80f0, tests "interface-vs-array-to-fs-unnamed" and
"interface-vs-unnamed-to-fs-array" are known to fail.
---
 .../interface-vs-unnamed-to-fs-unnamed.shader_test | 58 ++++++++++++++++++++++
 .../interface-vs-array-to-fs-named.shader_test     | 57 +++++++++++++++++++++
 .../interface-vs-array-to-fs-unnamed.shader_test   | 57 +++++++++++++++++++++
 .../interface-vs-named-to-fs-array.shader_test     | 55 ++++++++++++++++++++
 .../interface-vs-unnamed-to-fs-array.shader_test   | 55 ++++++++++++++++++++
 5 files changed, 282 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/execution/interface-vs-unnamed-to-fs-unnamed.shader_test
 create mode 100644 tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-named.shader_test
 create mode 100644 tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-unnamed.shader_test
 create mode 100644 tests/spec/glsl-1.50/linker/interface-vs-named-to-fs-array.shader_test
 create mode 100644 tests/spec/glsl-1.50/linker/interface-vs-unnamed-to-fs-array.shader_test

diff --git a/tests/spec/glsl-1.50/execution/interface-vs-unnamed-to-fs-unnamed.shader_test b/tests/spec/glsl-1.50/execution/interface-vs-unnamed-to-fs-unnamed.shader_test
new file mode 100644
index 0000000..76d1d94
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/interface-vs-unnamed-to-fs-unnamed.shader_test
@@ -0,0 +1,58 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+#     Matched block names within an interface (as defined above) must
+#     match in terms of having the same number of declarations with
+#     the same sequence of types and the same sequence of member
+#     names, as well as having the same member-wise layout
+#     qualification (see next section). Furthermore, if a matching
+#     block is declared as an array, then the array sizes must also
+#     match (or follow array matching rules for the interface between
+#     a vertex and a geometry shader).
+#
+# This test verifies that trying to link an unnamed VS output interface
+# to an unnamed FS input interface succeeds.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+out block {
+  vec4 a;
+  vec4 b;
+};
+
+out float ref;
+
+void main()
+{
+  gl_Position = piglit_vertex;
+  ref = 10.0 * float(gl_VertexID);
+  a = ref + vec4(0.0, 1.0, 2.0, 3.0);
+  b = ref + vec4(4.0, 5.0, 6.0, 7.0);
+}
+
+[fragment shader]
+in block {
+  vec4 a;
+  vec4 b;
+};
+
+in float ref;
+
+void main()
+{
+  bool ok = true;
+  if (distance(a, ref + vec4(0.0, 1.0, 2.0, 3.0)) > 1.0e-5)
+    ok = false;
+  if (distance(b, ref + vec4(4.0, 5.0, 6.0, 7.0)) > 1.0e-5)
+    ok = false;
+  gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-named.shader_test b/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-named.shader_test
new file mode 100644
index 0000000..0db615a
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-named.shader_test
@@ -0,0 +1,57 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+#     Matched block names within an interface (as defined above) must
+#     match in terms of having the same number of declarations with
+#     the same sequence of types and the same sequence of member
+#     names, as well as having the same member-wise layout
+#     qualification (see next section). Furthermore, if a matching
+#     block is declared as an array, then the array sizes must also
+#     match (or follow array matching rules for the interface between
+#     a vertex and a geometry shader).
+#
+# This test verifies that trying to link a VS output interface array
+# to a named FS input interface fails.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+out block {
+  vec4 a;
+  vec4 b;
+} inst[2];
+
+out float ref;
+
+void main()
+{
+  gl_Position = piglit_vertex;
+  ref = 10.0 * float(gl_VertexID);
+  inst[0].a = ref + vec4(0.0, 1.0, 2.0, 3.0);
+  inst[0].b = ref + vec4(4.0, 5.0, 6.0, 7.0);
+  inst[1].a = ref + vec4(0.0, 1.0, 2.0, 3.0);
+  inst[1].b = ref + vec4(4.0, 5.0, 6.0, 7.0);
+}
+
+[fragment shader]
+in block {
+  vec4 a;
+  vec4 b;
+} inst;
+
+in float ref;
+
+void main()
+{
+  bool ok = true;
+  if (distance(inst.a, ref + vec4(0.0, 1.0, 2.0, 3.0)) > 1.0e-5)
+    ok = false;
+  if (distance(inst.b, ref + vec4(4.0, 5.0, 6.0, 7.0)) > 1.0e-5)
+    ok = false;
+  gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-unnamed.shader_test b/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-unnamed.shader_test
new file mode 100644
index 0000000..c166ece
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/interface-vs-array-to-fs-unnamed.shader_test
@@ -0,0 +1,57 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+#     Matched block names within an interface (as defined above) must
+#     match in terms of having the same number of declarations with
+#     the same sequence of types and the same sequence of member
+#     names, as well as having the same member-wise layout
+#     qualification (see next section). Furthermore, if a matching
+#     block is declared as an array, then the array sizes must also
+#     match (or follow array matching rules for the interface between
+#     a vertex and a geometry shader).
+#
+# This test verifies that trying to link a VS output interface array
+# to an unnamed FS input interface fails.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+out block {
+  vec4 a;
+  vec4 b;
+} inst[2];
+
+out float ref;
+
+void main()
+{
+  gl_Position = piglit_vertex;
+  ref = 10.0 * float(gl_VertexID);
+  inst[0].a = ref + vec4(0.0, 1.0, 2.0, 3.0);
+  inst[0].b = ref + vec4(4.0, 5.0, 6.0, 7.0);
+  inst[1].a = ref + vec4(0.0, 1.0, 2.0, 3.0);
+  inst[1].b = ref + vec4(4.0, 5.0, 6.0, 7.0);
+}
+
+[fragment shader]
+in block {
+  vec4 a;
+  vec4 b;
+};
+
+in float ref;
+
+void main()
+{
+  bool ok = true;
+  if (distance(a, ref + vec4(0.0, 1.0, 2.0, 3.0)) > 1.0e-5)
+    ok = false;
+  if (distance(b, ref + vec4(4.0, 5.0, 6.0, 7.0)) > 1.0e-5)
+    ok = false;
+  gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/linker/interface-vs-named-to-fs-array.shader_test b/tests/spec/glsl-1.50/linker/interface-vs-named-to-fs-array.shader_test
new file mode 100644
index 0000000..214534e
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/interface-vs-named-to-fs-array.shader_test
@@ -0,0 +1,55 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+#     Matched block names within an interface (as defined above) must
+#     match in terms of having the same number of declarations with
+#     the same sequence of types and the same sequence of member
+#     names, as well as having the same member-wise layout
+#     qualification (see next section). Furthermore, if a matching
+#     block is declared as an array, then the array sizes must also
+#     match (or follow array matching rules for the interface between
+#     a vertex and a geometry shader).
+#
+# This test verifies that trying to link a named VS output interface
+# to an FS input interface array fails.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+out block {
+  vec4 a;
+  vec4 b;
+} inst;
+
+out float ref;
+
+void main()
+{
+  gl_Position = piglit_vertex;
+  ref = 10.0 * float(gl_VertexID);
+  inst.a = ref + vec4(0.0, 1.0, 2.0, 3.0);
+  inst.b = ref + vec4(4.0, 5.0, 6.0, 7.0);
+}
+
+[fragment shader]
+in block {
+  vec4 a;
+  vec4 b;
+} inst[2];
+
+in float ref;
+
+void main()
+{
+  bool ok = true;
+  if (distance(inst[0].a, ref + vec4(0.0, 1.0, 2.0, 3.0)) > 1.0e-5)
+    ok = false;
+  if (distance(inst[1].b, ref + vec4(4.0, 5.0, 6.0, 7.0)) > 1.0e-5)
+    ok = false;
+  gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/linker/interface-vs-unnamed-to-fs-array.shader_test b/tests/spec/glsl-1.50/linker/interface-vs-unnamed-to-fs-array.shader_test
new file mode 100644
index 0000000..57ff55f
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/interface-vs-unnamed-to-fs-array.shader_test
@@ -0,0 +1,55 @@
+# From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+#
+#     Matched block names within an interface (as defined above) must
+#     match in terms of having the same number of declarations with
+#     the same sequence of types and the same sequence of member
+#     names, as well as having the same member-wise layout
+#     qualification (see next section). Furthermore, if a matching
+#     block is declared as an array, then the array sizes must also
+#     match (or follow array matching rules for the interface between
+#     a vertex and a geometry shader).
+#
+# This test verifies that trying to link an unnamed VS output interface
+# to an FS input interface array fails.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+in vec4 piglit_vertex;
+
+out block {
+  vec4 a;
+  vec4 b;
+};
+
+out float ref;
+
+void main()
+{
+  gl_Position = piglit_vertex;
+  ref = 10.0 * float(gl_VertexID);
+  a = ref + vec4(0.0, 1.0, 2.0, 3.0);
+  b = ref + vec4(4.0, 5.0, 6.0, 7.0);
+}
+
+[fragment shader]
+in block {
+  vec4 a;
+  vec4 b;
+} inst[2];
+
+in float ref;
+
+void main()
+{
+  bool ok = true;
+  if (distance(inst[0].a, ref + vec4(0.0, 1.0, 2.0, 3.0)) > 1.0e-5)
+    ok = false;
+  if (distance(inst[1].b, ref + vec4(4.0, 5.0, 6.0, 7.0)) > 1.0e-5)
+    ok = false;
+  gl_FragColor = ok ? vec4(0.0, 1.0, 0.0, 1.0) : vec4(1.0, 0.0, 0.0, 1.0);
+}
+
+[test]
+link error
-- 
1.8.4.2



More information about the Piglit mailing list