[Piglit] [PATCH] gs: Test rules related to geometry shader input sizes.

Paul Berry stereotype441 at gmail.com
Fri Jul 26 06:46:09 PDT 2013


Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec
contains some tricky rules for how the sizes of geometry shader input
arrays are related to the input layout specification.  In essence,
those rules boil down to the following:

- If an input array declaration does not specify a size, and it
  follows an input layout declaration, it is sized according to the
  input layout.

- If an input layout declaration follows an input array declaration
  that didn't specify a size, the input array declaration is given a
  size at the time the input layout declaration appears.

- All input layout declarations and input array sizes must ultimately
  match.  Inconsistencies are reported as soon as they are detected,
  at compile time if the inconsistency is within one compilation unit,
  otherwise at link time.

- At least one compilation unit must contain an input layout
  declaration.

This patch includes tests for verifying all of these behaviours,
modelled as closely as possible from the text and examples in the GLSL
1.50 spec.  Both interface block style and and non-interface block
style declarations are tested.
---
 ...-sizing-consistent-with-prev-length-blocks.geom | 38 +++++++++
 ...s-input-sizing-consistent-with-prev-length.geom | 31 ++++++++
 .../gs-input-sizing-implied-length-blocks.geom     | 31 ++++++++
 ...d-length-consistent-with-prev-usage-blocks.geom | 39 +++++++++
 ...-implied-length-consistent-with-prev-usage.geom | 36 +++++++++
 ...length-inconsistent-with-prev-usage-blocks.geom | 39 +++++++++
 ...mplied-length-inconsistent-with-prev-usage.geom | 36 +++++++++
 .../compiler/gs-input-sizing-implied-length.geom   | 27 +++++++
 .../gs-input-sizing-inconsistent-blocks.geom       | 35 ++++++++
 .../compiler/gs-input-sizing-inconsistent.geom     | 29 +++++++
 ...-sizing-layout-consistent-with-prev-layout.geom | 29 +++++++
 ...yout-inconsistent-with-later-length-blocks.geom | 33 ++++++++
 ...zing-layout-inconsistent-with-later-length.geom | 29 +++++++
 ...izing-layout-inconsistent-with-prev-layout.geom | 30 +++++++
 ...ayout-inconsistent-with-prev-length-blocks.geom | 23 ++++++
 ...izing-layout-inconsistent-with-prev-length.geom | 19 +++++
 ...gs-input-sizing-length-after-layout-blocks.geom | 39 +++++++++
 .../gs-input-sizing-length-after-layout.geom       | 36 +++++++++
 ...nput-sizing-length-after-other-size-blocks.geom | 40 ++++++++++
 .../gs-input-sizing-length-after-other-size.geom   | 34 ++++++++
 ...s-input-sizing-length-before-layout-blocks.geom | 38 +++++++++
 .../gs-input-sizing-length-before-layout.geom      | 36 +++++++++
 .../gs-input-sizing-implied-length.shader_test     | 84 ++++++++++++++++++++
 ...layout-consistent-with-static-usage.shader_test | 82 +++++++++++++++++++
 ...ing-layout-larger-than-static-usage.shader_test | 83 +++++++++++++++++++
 ...gs-input-sizing-length-after-layout.shader_test | 92 ++++++++++++++++++++++
 ...ut-sizing-conflicting-input-layouts.shader_test | 64 +++++++++++++++
 ...g-layout-conflicts-with-size-blocks.shader_test | 64 +++++++++++++++
 ...t-sizing-layout-conflicts-with-size.shader_test | 57 ++++++++++++++
 ...-layout-conflicts-with-static-usage.shader_test | 61 ++++++++++++++
 ...put-sizing-no-input-layout-declared.shader_test | 61 ++++++++++++++
 31 files changed, 1375 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-consistent-with-prev-length-blocks.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-consistent-with-prev-length.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-blocks.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-consistent-with-prev-usage-blocks.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-consistent-with-prev-usage.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-inconsistent-with-prev-usage-blocks.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-inconsistent-with-prev-usage.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-inconsistent-blocks.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-inconsistent.geom
 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-later-length-blocks.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-later-length.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/compiler/gs-input-sizing-layout-inconsistent-with-prev-length-blocks.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-prev-length.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-layout-blocks.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-layout.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-other-size-blocks.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-other-size.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-length-before-layout-blocks.geom
 create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-length-before-layout.geom
 create mode 100644 tests/spec/glsl-1.50/execution/gs-input-sizing-implied-length.shader_test
 create mode 100644 tests/spec/glsl-1.50/execution/gs-input-sizing-layout-consistent-with-static-usage.shader_test
 create mode 100644 tests/spec/glsl-1.50/execution/gs-input-sizing-layout-larger-than-static-usage.shader_test
 create mode 100644 tests/spec/glsl-1.50/execution/gs-input-sizing-length-after-layout.shader_test
 create mode 100644 tests/spec/glsl-1.50/linker/gs-input-sizing-conflicting-input-layouts.shader_test
 create mode 100644 tests/spec/glsl-1.50/linker/gs-input-sizing-layout-conflicts-with-size-blocks.shader_test
 create mode 100644 tests/spec/glsl-1.50/linker/gs-input-sizing-layout-conflicts-with-size.shader_test
 create mode 100644 tests/spec/glsl-1.50/linker/gs-input-sizing-layout-conflicts-with-static-usage.shader_test
 create mode 100644 tests/spec/glsl-1.50/linker/gs-input-sizing-no-input-layout-declared.shader_test

diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-consistent-with-prev-length-blocks.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-consistent-with-prev-length-blocks.geom
new file mode 100644
index 0000000..3caa10d
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-consistent-with-prev-length-blocks.geom
@@ -0,0 +1,38 @@
+// 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 after
+// declaraing geometry shader inputs that are either unsized or have a
+// size consistent with the declared layout.  This test verifies the
+// case for input interface blocks.
+//
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in blk1 {
+  vec4 Color;
+} inst1[];
+
+in blk2 {
+  vec4 Color;
+} inst2[2];
+
+layout(lines) in;
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-consistent-with-prev-length.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-consistent-with-prev-length.geom
new file mode 100644
index 0000000..e91069b
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-consistent-with-prev-length.geom
@@ -0,0 +1,31 @@
+// 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 after
+// declaraing geometry shader inputs that are either unsized or have a
+// size consistent with the declared layout.
+//
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in vec4 Color1[];
+in vec4 Color2[2];
+layout(lines) in;
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-blocks.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-blocks.geom
new file mode 100644
index 0000000..b3c7594
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-blocks.geom
@@ -0,0 +1,31 @@
+// Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+//
+//   All geometry shader input unsized array declarations will be
+//   sized by an earlier input layout qualifier, when present, as per
+//   the following table.
+//
+// Followed by a table mapping each allowed input layout qualifier to
+// the corresponding input length.
+//
+// This test verifies that if an unsized array declaration follows an
+// input layout qualifier, the size is implied.  This test verifies
+// the case for input interface blocks.
+//
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+layout(lines) in;
+
+in blk {
+  vec4 Color;
+} inst[];
+
+int foo()
+{
+  return inst.length();
+}
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-consistent-with-prev-usage-blocks.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-consistent-with-prev-usage-blocks.geom
new file mode 100644
index 0000000..350b986
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-consistent-with-prev-usage-blocks.geom
@@ -0,0 +1,39 @@
+// 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 that when a layout declaration causes a
+// previously unsized geometry shader input array to become sized, if
+// an intervening usage of that input array was consistent with the
+// new size, there is no error.  This test verifies the case for input
+// interface blocks.
+//
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in blk {
+  vec4 Color;
+} inst[];
+
+vec4 foo()
+{
+  return inst[2].Color;
+}
+
+layout(triangles) in;
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-consistent-with-prev-usage.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-consistent-with-prev-usage.geom
new file mode 100644
index 0000000..c1fc45c
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-consistent-with-prev-usage.geom
@@ -0,0 +1,36 @@
+// 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 that when a layout declaration causes a
+// previously unsized geometry shader input array to become sized, if
+// an intervening usage of that input array was consistent with the
+// new size, there is no error.
+//
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in vec4 Color[];
+
+vec4 foo()
+{
+  return Color[2];
+}
+
+layout(triangles) in;
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-inconsistent-with-prev-usage-blocks.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-inconsistent-with-prev-usage-blocks.geom
new file mode 100644
index 0000000..d882d8a
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-inconsistent-with-prev-usage-blocks.geom
@@ -0,0 +1,39 @@
+// 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 that when a layout declaration causes a
+// previously unsized geometry shader input array to become sized, if
+// an intervening usage of that input array wasn't consistent with the
+// new size, there is an error.  This test verifies the case for input
+// interface blocks.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in blk {
+  vec4 Color;
+} inst[];
+
+vec4 foo()
+{
+  return inst[2].Color;
+}
+
+layout(lines) in;
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-inconsistent-with-prev-usage.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-inconsistent-with-prev-usage.geom
new file mode 100644
index 0000000..f60a807
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-inconsistent-with-prev-usage.geom
@@ -0,0 +1,36 @@
+// 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 that when a layout declaration causes a
+// previously unsized geometry shader input array to become sized, if
+// an intervening usage of that input array wasn't consistent with the
+// new size, there is an error.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in vec4 Color[];
+
+vec4 foo()
+{
+  return Color[2];
+}
+
+layout(lines) in;
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length.geom
new file mode 100644
index 0000000..af7c73f
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length.geom
@@ -0,0 +1,27 @@
+// Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+//
+//   All geometry shader input unsized array declarations will be
+//   sized by an earlier input layout qualifier, when present, as per
+//   the following table.
+//
+// Followed by a table mapping each allowed input layout qualifier to
+// the corresponding input length.
+//
+// This test verifies that if an unsized array declaration follows an
+// input layout qualifier, the size is implied.
+//
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+layout(lines) in;
+in vec4 Color[];
+
+int foo()
+{
+  return Color.length();
+}
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-inconsistent-blocks.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-inconsistent-blocks.geom
new file mode 100644
index 0000000..860455f
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-inconsistent-blocks.geom
@@ -0,0 +1,35 @@
+// 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 declaring
+// two geometry shader inputs with different array sizes causes a
+// compile error.  This test verifies the case for input interface
+// blocks.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in blk1 {
+  vec4 Color;
+} inst2[2];
+
+in blk2 {
+  vec4 Color;
+} inst3[3];
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-inconsistent.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-inconsistent.geom
new file mode 100644
index 0000000..568ea5a
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-inconsistent.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 declaring
+// two geometry shader inputs with different array sizes causes a
+// compile error.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in vec4 Color2[2];
+in vec4 Color3[3];
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-later-length-blocks.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-later-length-blocks.geom
new file mode 100644
index 0000000..c227ec0
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-later-length-blocks.geom
@@ -0,0 +1,33 @@
+// 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 with an explicit
+// array size that is inconsistent with a previous layout declaration.
+// This test verifies the case for input interface blocks.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+layout(lines) in;
+
+in blk4 {
+  vec4 Color;
+} inst4[3];
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-later-length.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-later-length.geom
new file mode 100644
index 0000000..d2f7b7c
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-later-length.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 an error
+// results from declaring a geometry shader input with an explicit
+// array size that is inconsistent with a previous layout declaration.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+layout(lines) in;
+in vec4 Color4[3];
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/compiler/gs-input-sizing-layout-inconsistent-with-prev-length-blocks.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-prev-length-blocks.geom
new file mode 100644
index 0000000..4f0ec10
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-prev-length-blocks.geom
@@ -0,0 +1,23 @@
+// Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+//
+//   It is a compile-time error if a layout declaration's array size
+//   (from table above) does not match any array size specified in
+//   declarations of an input variable in the same shader.
+//
+// This test verifies the case where the input variable declaration
+// precedes the layout declaration.  This test verifies the case for
+// input interface blocks.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in blk {
+  vec4 Color;
+} inst[3];
+
+layout(lines) in;
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-prev-length.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-prev-length.geom
new file mode 100644
index 0000000..6688ef0
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-layout-inconsistent-with-prev-length.geom
@@ -0,0 +1,19 @@
+// Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+//
+//   It is a compile-time error if a layout declaration's array size
+//   (from table above) does not match any array size specified in
+//   declarations of an input variable in the same shader.
+//
+// This test verifies the case where the input variable declaration
+// precedes the layout declaration.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in vec4 Color[3];
+layout(lines) in;
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-layout-blocks.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-layout-blocks.geom
new file mode 100644
index 0000000..1d5ac5b
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-layout-blocks.geom
@@ -0,0 +1,39 @@
+// 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 it is
+// legal to call .length() on an unsized geometry shader input array,
+// if an input layout declaration occurs between the declaration of
+// the input and the call to .length().  This test verifies the case
+// for input interface blocks.
+//
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in blk1 {
+  vec4 Color;
+} inst1[];
+
+layout(lines) in;
+
+int foo()
+{
+  return inst1.length();
+}
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-layout.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-layout.geom
new file mode 100644
index 0000000..69dad0a
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-layout.geom
@@ -0,0 +1,36 @@
+// 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 it is
+// legal to call .length() on an unsized geometry shader input array,
+// if an input layout declaration occurs between the declaration of
+// the input and the call to .length().
+//
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in vec4 Color1[];
+
+layout(lines) in;
+
+int foo()
+{
+  return Color1.length();
+}
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-other-size-blocks.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-other-size-blocks.geom
new file mode 100644
index 0000000..5cd9320
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-other-size-blocks.geom
@@ -0,0 +1,40 @@
+// 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 declaring
+// a geometry shader input with a size does not cause previously
+// declared unsized geometry shader inputs to acquire that size.  This
+// test verifies the case for input interface blocks.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in blk1 {
+  vec4 Color;
+} inst1[];
+
+in blk2 {
+  vec4 Color;
+} inst2[2];
+
+int foo()
+{
+  return inst1.length();
+}
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-other-size.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-other-size.geom
new file mode 100644
index 0000000..cd4b243
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-other-size.geom
@@ -0,0 +1,34 @@
+// 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 declaring
+// a geometry shader input with a size does not cause previously
+// declared unsized geometry shader inputs to acquire that size.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in vec4 Color1[];
+in vec4 Color2[2];
+
+int foo()
+{
+  return Color1.length();
+}
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-before-layout-blocks.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-before-layout-blocks.geom
new file mode 100644
index 0000000..364d9ff
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-before-layout-blocks.geom
@@ -0,0 +1,38 @@
+// 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 it is
+// illegal to call .length() on an unsized geometry shader input
+// array, even if an input layout declaration occurs later in the
+// shader.  This test verifies the case for input interface blocks.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in blk1 {
+  vec4 Color;
+} inst1[];
+
+int foo()
+{
+  return inst1.length();
+}
+
+layout(lines) in;
diff --git a/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-before-layout.geom b/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-before-layout.geom
new file mode 100644
index 0000000..d806a22
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-before-layout.geom
@@ -0,0 +1,36 @@
+// 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 it is
+// illegal to call .length() on an unsized geometry shader input
+// array, even if an input layout declaration occurs later in the
+// shader.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// check_link: false
+// [end config]
+
+#version 150
+
+in vec4 Color1[];
+
+int foo()
+{
+  return Color1.length();
+}
+
+layout(lines) in;
diff --git a/tests/spec/glsl-1.50/execution/gs-input-sizing-implied-length.shader_test b/tests/spec/glsl-1.50/execution/gs-input-sizing-implied-length.shader_test
new file mode 100644
index 0000000..7356679
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/gs-input-sizing-implied-length.shader_test
@@ -0,0 +1,84 @@
+# Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+#
+#   All geometry shader input unsized array declarations will be
+#   sized by an earlier input layout qualifier, when present, as per
+#   the following table.
+#
+# Followed by a table mapping each allowed input layout qualifier to
+# the corresponding input length.
+#
+# This test verifies that if an unsized array declaration follows an
+# input layout qualifier, the correct size is implied.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in int value;
+flat out int value_to_gs;
+
+void main()
+{
+  value_to_gs = value;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 4) out;
+flat in int value_to_gs[];
+out vec4 color_to_fs;
+
+void main()
+{
+  vec4 color;
+  if (value_to_gs.length() == 3)
+    color = vec4(0.0, 1.0, 0.0, 1.0);
+  else
+    color = vec4(0.0, 1.0, 0.0, 1.0);
+
+  /* Prevent value_to_gs from being optimized out, which might cause
+   * the VS input "value" to be optimized out, leading to a bogus
+   * failure.
+   */
+  color += float(value_to_gs[0]);
+
+  gl_Position = vec4(-1.0, -1.0, 0.0, 1.0);
+  color_to_fs = color;
+  EmitVertex();
+  gl_Position = vec4(-1.0, 1.0, 0.0, 1.0);
+  color_to_fs = color;
+  EmitVertex();
+  gl_Position = vec4(1.0, -1.0, 0.0, 1.0);
+  color_to_fs = color;
+  EmitVertex();
+  gl_Position = vec4(1.0, 1.0, 0.0, 1.0);
+  color_to_fs = color;
+  EmitVertex();
+}
+
+[fragment shader]
+#version 150
+
+in vec4 color_to_fs;
+out vec4 color;
+
+void main()
+{
+  color = color_to_fs;
+}
+
+[vertex data]
+value/int/1
+0
+1
+2
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw arrays GL_TRIANGLES 0 3
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.50/execution/gs-input-sizing-layout-consistent-with-static-usage.shader_test b/tests/spec/glsl-1.50/execution/gs-input-sizing-layout-consistent-with-static-usage.shader_test
new file mode 100644
index 0000000..96d1f7f
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/gs-input-sizing-layout-consistent-with-static-usage.shader_test
@@ -0,0 +1,82 @@
+# Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+#
+# It is a link-time error if not all provided sizes (sized input
+# arrays and layout size) match across all geometry shaders in the
+# program.
+#
+# This test exercises the case where one compilation unit provides a
+# size via a layout declaration, and another provides a size
+# implicitly by accessing a member of an input array using a constant
+# that is consistent with the size provided in the layout declaration.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in int value;
+flat out int value_to_gs;
+
+void main()
+{
+  value_to_gs = value;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 4) out;
+
+void do_vertex();
+
+void main()
+{
+  gl_Position = vec4(-1.0, -1.0, 0.0, 1.0);
+  do_vertex();
+  gl_Position = vec4(-1.0, 1.0, 0.0, 1.0);
+  do_vertex();
+  gl_Position = vec4(1.0, -1.0, 0.0, 1.0);
+  do_vertex();
+  gl_Position = vec4(1.0, 1.0, 0.0, 1.0);
+  do_vertex();
+}
+
+[geometry shader]
+#version 150
+
+flat in int value_to_gs[];
+out vec4 color_to_fs;
+
+void do_vertex()
+{
+  if (value_to_gs[2] == 2)
+    color_to_fs = vec4(0.0, 1.0, 0.0, 1.0);
+  else
+    color_to_fs = vec4(1.0, 0.0, 0.0, 1.0);
+  EmitVertex();
+}
+
+[fragment shader]
+#version 150
+
+in vec4 color_to_fs;
+out vec4 color;
+
+void main()
+{
+  color = color_to_fs;
+}
+
+[vertex data]
+value/int/1
+0
+1
+2
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw arrays GL_TRIANGLES 0 3
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.50/execution/gs-input-sizing-layout-larger-than-static-usage.shader_test b/tests/spec/glsl-1.50/execution/gs-input-sizing-layout-larger-than-static-usage.shader_test
new file mode 100644
index 0000000..a400c0e
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/gs-input-sizing-layout-larger-than-static-usage.shader_test
@@ -0,0 +1,83 @@
+# Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+#
+# It is a link-time error if not all provided sizes (sized input
+# arrays and layout size) match across all geometry shaders in the
+# program.
+#
+# This test exercises the case where one compilation unit provides a
+# size via a layout declaration, and another provides a size
+# implicitly by accessing a member of an input array using a constant
+# that implies a size smaller than the size provided in the layout
+# declaration.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in int value;
+flat out int value_to_gs;
+
+void main()
+{
+  value_to_gs = value;
+}
+
+[geometry shader]
+#version 150
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 4) out;
+
+void do_vertex();
+
+void main()
+{
+  gl_Position = vec4(-1.0, -1.0, 0.0, 1.0);
+  do_vertex();
+  gl_Position = vec4(-1.0, 1.0, 0.0, 1.0);
+  do_vertex();
+  gl_Position = vec4(1.0, -1.0, 0.0, 1.0);
+  do_vertex();
+  gl_Position = vec4(1.0, 1.0, 0.0, 1.0);
+  do_vertex();
+}
+
+[geometry shader]
+#version 150
+
+flat in int value_to_gs[];
+out vec4 color_to_fs;
+
+void do_vertex()
+{
+  if (value_to_gs[1] == 1)
+    color_to_fs = vec4(0.0, 1.0, 0.0, 1.0);
+  else
+    color_to_fs = vec4(1.0, 0.0, 0.0, 1.0);
+  EmitVertex();
+}
+
+[fragment shader]
+#version 150
+
+in vec4 color_to_fs;
+out vec4 color;
+
+void main()
+{
+  color = color_to_fs;
+}
+
+[vertex data]
+value/int/1
+0
+1
+2
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw arrays GL_TRIANGLES 0 3
+probe all rgba 0.0 1.0 0.0 1.0
diff --git a/tests/spec/glsl-1.50/execution/gs-input-sizing-length-after-layout.shader_test b/tests/spec/glsl-1.50/execution/gs-input-sizing-length-after-layout.shader_test
new file mode 100644
index 0000000..95ca2b1
--- /dev/null
+++ b/tests/spec/glsl-1.50/execution/gs-input-sizing-length-after-layout.shader_test
@@ -0,0 +1,92 @@
+# 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 the correct
+# value is returned by .length() on an unsized geometry shader input
+# array, if an input layout declaration occurs between the declaration
+# of the input and the call to .length().
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in int value;
+flat out int value_to_gs;
+
+void main()
+{
+  value_to_gs = value;
+}
+
+[geometry shader]
+#version 150
+
+flat in int value_to_gs[];
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 4) out;
+out vec4 color_to_fs;
+
+void main()
+{
+  vec4 color;
+  if (value_to_gs.length() == 3)
+    color = vec4(0.0, 1.0, 0.0, 1.0);
+  else
+    color = vec4(0.0, 1.0, 0.0, 1.0);
+
+  /* Prevent value_to_gs from being optimized out, which might cause
+   * the VS input "value" to be optimized out, leading to a bogus
+   * failure.
+   */
+  color += float(value_to_gs[0]);
+
+  gl_Position = vec4(-1.0, -1.0, 0.0, 1.0);
+  color_to_fs = color;
+  EmitVertex();
+  gl_Position = vec4(-1.0, 1.0, 0.0, 1.0);
+  color_to_fs = color;
+  EmitVertex();
+  gl_Position = vec4(1.0, -1.0, 0.0, 1.0);
+  color_to_fs = color;
+  EmitVertex();
+  gl_Position = vec4(1.0, 1.0, 0.0, 1.0);
+  color_to_fs = color;
+  EmitVertex();
+}
+
+[fragment shader]
+#version 150
+
+in vec4 color_to_fs;
+out vec4 color;
+
+void main()
+{
+  color = color_to_fs;
+}
+
+[vertex data]
+value/int/1
+0
+1
+2
+
+[test]
+clear color 0.0 0.0 0.0 0.0
+clear
+draw arrays GL_TRIANGLES 0 3
+probe all rgba 0.0 1.0 0.0 1.0
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
diff --git a/tests/spec/glsl-1.50/linker/gs-input-sizing-layout-conflicts-with-size-blocks.shader_test b/tests/spec/glsl-1.50/linker/gs-input-sizing-layout-conflicts-with-size-blocks.shader_test
new file mode 100644
index 0000000..09e88c1
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/gs-input-sizing-layout-conflicts-with-size-blocks.shader_test
@@ -0,0 +1,64 @@
+# Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+#
+# It is a link-time error if not all provided sizes (sized input
+# arrays and layout size) match across all geometry shaders in the
+# program.
+#
+# This test verifies the case for input interface blocks.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+#version 150
+
+in vec4 vertex;
+
+out blk {
+  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
+
+in blk {
+  vec4 vertex_to_gs;
+} inst[3];
+
+void do_vertex(int i)
+{
+  gl_Position = inst[i].vertex_to_gs;
+  EmitVertex();
+}
+
+[fragment shader]
+#version 150
+
+out vec4 color;
+
+void main()
+{
+  color = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/linker/gs-input-sizing-layout-conflicts-with-size.shader_test b/tests/spec/glsl-1.50/linker/gs-input-sizing-layout-conflicts-with-size.shader_test
new file mode 100644
index 0000000..a7e2a59
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/gs-input-sizing-layout-conflicts-with-size.shader_test
@@ -0,0 +1,57 @@
+# Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+#
+# It is a link-time error if not all provided sizes (sized input
+# arrays and layout size) match across all geometry shaders in the
+# program.
+
+[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
+
+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
diff --git a/tests/spec/glsl-1.50/linker/gs-input-sizing-layout-conflicts-with-static-usage.shader_test b/tests/spec/glsl-1.50/linker/gs-input-sizing-layout-conflicts-with-static-usage.shader_test
new file mode 100644
index 0000000..4225ef4
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/gs-input-sizing-layout-conflicts-with-static-usage.shader_test
@@ -0,0 +1,61 @@
+# Section 4.3.8.1 (Input Layout Qualifiers) of the GLSL 1.50 spec says:
+#
+# It is a link-time error if not all provided sizes (sized input
+# arrays and layout size) match across all geometry shaders in the
+# program.
+#
+# This test exercises the case where one compilation unit provides a
+# size via a layout declaration, and another provides a size
+# implicitly by accessing a member of an input array using a constant.
+
+[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();
+
+void main()
+{
+  for (int i = 0; i < 2; i++)
+    do_vertex();
+}
+
+[geometry shader]
+#version 150
+
+in vec4 vertex_to_gs[];
+
+void do_vertex()
+{
+  gl_Position = vertex_to_gs[2];
+  EmitVertex();
+}
+
+[fragment shader]
+#version 150
+
+out vec4 color;
+
+void main()
+{
+  color = vec4(0.0, 1.0, 0.0, 1.0);
+}
+
+[test]
+link error
diff --git a/tests/spec/glsl-1.50/linker/gs-input-sizing-no-input-layout-declared.shader_test b/tests/spec/glsl-1.50/linker/gs-input-sizing-no-input-layout-declared.shader_test
new file mode 100644
index 0000000..f04107d
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/gs-input-sizing-no-input-layout-declared.shader_test
@@ -0,0 +1,61 @@
+# 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 no compilation unit
+# declares an input layout.
+
+[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(triangle_strip, max_vertices = 3) out;
+
+void do_vertex(int i);
+
+void main()
+{
+  for (int i = 0; i < 3; i++)
+    do_vertex(i);
+}
+
+[geometry shader]
+#version 150
+
+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