[Piglit] [PATCH 2/8] gs: Verify intra-shader checking of input layout vs. explicitly sized arrays.

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


These tests verify that the implementation properly detects mismatches
between a geometry shader input layout declaration and an explicitly
sized geometry shader input array appearing in the same shader (the
size of each input array must match the number of vertices per
primitive implied by the input layout declaration).

v2: Call .length() from inside an array declaration to verify that the
compiler properly treats it as a constant expression.
---
 ...-sizing-consistent-with-prev-length-blocks.geom | 38 ++++++++++++++++++++++
 ...s-input-sizing-consistent-with-prev-length.geom | 31 ++++++++++++++++++
 ...yout-inconsistent-with-later-length-blocks.geom | 33 +++++++++++++++++++
 ...zing-layout-inconsistent-with-later-length.geom | 29 +++++++++++++++++
 ...ayout-inconsistent-with-prev-length-blocks.geom | 23 +++++++++++++
 ...izing-layout-inconsistent-with-prev-length.geom | 19 +++++++++++
 ...gs-input-sizing-length-after-layout-blocks.geom | 36 ++++++++++++++++++++
 .../gs-input-sizing-length-after-layout.geom       | 33 +++++++++++++++++++
 8 files changed, 242 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-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-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

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-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-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..6e2937c
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-layout-blocks.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().  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;
+
+uniform int foo[inst1.length() == 2 ? 1 : -1];
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..c2dbb75
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-length-after-layout.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 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;
+
+uniform int foo[Color1.length() == 2 ? 1 : -1];
-- 
1.8.3.4



More information about the Piglit mailing list