[Piglit] [PATCH 1/8] gs: Verify consistency checking of geometry shader input layouts.

Paul Berry stereotype441 at gmail.com
Mon Aug 12 15:03:22 PDT 2013


These tests verify that the implementation properly detects mismatches
between geometry shader input layout declarations, whether they occur
within the same compilation unit or within multiple compilation units.

Mismatches that occur within the same compilation unit should produce
a compile error.
---
 ...-sizing-layout-consistent-with-prev-layout.geom | 29 ++++++++++
 ...izing-layout-inconsistent-with-prev-layout.geom | 30 ++++++++++
 ...ut-sizing-conflicting-input-layouts.shader_test | 64 ++++++++++++++++++++++
 3 files changed, 123 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-consistent-with-prev-layout.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-prev-layout.geom
 create mode 100644 tests/spec/glsl-1.50/linker/gs-input-sizing-conflicting-input-layouts.shader_test

diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-consistent-with-prev-layout.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-consistent-with-prev-layout.geom
new file mode 100644
index 0000000..2de59cd
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-consistent-with-prev-layout.geom
@@ -0,0 +1,29 @@
+// Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec
+// includes the following examples of compile-time errors:
+//
+//   // code sequence within one shader...
+//   in vec4 Color1[];    // size unknown
+//   ...Color1.length()...// illegal, length() unknown
+//   in vec4 Color2[2];   // size is 2
+//   ...Color1.length()...// illegal, Color1 still has no size
+//   in vec4 Color3[3];   // illegal, input sizes are inconsistent
+//   layout(lines) in;    // legal, input size is 2, matching
+//   in vec4 Color4[3];   // illegal, contradicts layout
+//   ...Color1.length()...// legal, length() is 2, Color1 sized by layout()
+//   layout(lines) in;    // legal, matches other layout() declaration (*)
+//   layout(triangles) in;// illegal, does not match earlier layout() declaration
+//
+// This test verifies the case marked with (*), namely that no error
+// results from declaring a geometry shader input layout that is
+// consistent with a previously declared geometry shader input layout.
+//
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+layout(lines) in;
+layout(lines) in;
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-prev-layout.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-prev-layout.geom
new file mode 100644
index 0000000..85f7a90
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-prev-layout.geom
@@ -0,0 +1,30 @@
+// Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec
+// includes the following examples of compile-time errors:
+//
+//   // code sequence within one shader...
+//   in vec4 Color1[];    // size unknown
+//   ...Color1.length()...// illegal, length() unknown
+//   in vec4 Color2[2];   // size is 2
+//   ...Color1.length()...// illegal, Color1 still has no size
+//   in vec4 Color3[3];   // illegal, input sizes are inconsistent
+//   layout(lines) in;    // legal, input size is 2, matching
+//   in vec4 Color4[3];   // illegal, contradicts layout
+//   ...Color1.length()...// legal, length() is 2, Color1 sized by layout()
+//   layout(lines) in;    // legal, matches other layout() declaration
+//   layout(triangles) in;// illegal, does not match earlier layout() declaration (*)
+//
+// This test verifies the case marked with (*), namely that an error
+// results from declaring a geometry shader input layout that is
+// inconsistent with a previously declared geometry shader input
+// layout.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+layout(lines) in;
+layout(triangles) in;
diff --git a/tests/spec/glsl-1.50/linker/gs-input-sizing-conflicting-input-layouts.shader_test b/tests/spec/glsl-1.50/linker/gs-input-sizing-conflicting-input-layouts.shader_test
new file mode 100644
index 0000000..0b8221e
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/gs-input-sizing-conflicting-input-layouts.shader_test
@@ -0,0 +1,64 @@
+# Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+#
+# At least one geometry shader (compilation unit) in a program must
+# declare an input layout, and all geometry shader input layout
+# declarations in a program must declare the same layout. It is not
+# required that all geometry shaders in a program declare an input
+# layout.
+#
+# This test verifies that a link error occurs if two compilation units
+# declare conflicting layouts.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+out vec4 vertex_to_gs;
+
+void main()
+{
+  vertex_to_gs = vertex;
+}
+
+[geometry shader]
+#version 150
+
+layout(lines) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+void do_vertex(int i);
+
+void main()
+{
+  for (int i = 0; i < 2; i++)
+    do_vertex(i);
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+
+in vec4 vertex_to_gs[3];
+
+void do_vertex(int i)
+{
+  gl_Position = vertex_to_gs[i];
+  EmitVertex();
+}
+
+[fragment shader]
+#version 150
+
+out vec4 color;
+
+void main()
+{
+  color = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+link error
-- 
1.8.3.4



More information about the Piglit mailing list