[Piglit] [PATCH 4/8] gs: Verify intra-shader checking of input layout vs. implicitly sized arrays.
Paul Berry
stereotype441 at gmail.com
Mon Aug 12 15:03:25 PDT 2013
These tests verify the following interactions between geometry shader
input layout declarations and implicitly sized geometry shader input
arrays:
- 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. An error
should be reported if the new size conflicts with previous uses of
the array.
v2: Call .length() from inside an array declaration to verify that the
compiler properly treats it as a constant expression. Remove
gs-input-sizing-implied-length.shader_test, since it is redundant with
gs-input-sizing-implied-length.geom.
---
.../gs-input-sizing-implied-length-blocks.geom | 28 ++++++++++++++++
...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 | 24 +++++++++++++
...s-input-sizing-length-before-layout-blocks.geom | 38 +++++++++++++++++++++
.../gs-input-sizing-length-before-layout.geom | 36 ++++++++++++++++++++
8 files changed, 276 insertions(+)
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-length-before-layout-blocks.geom
create mode 100644 tests/spec/glsl-1.50/compiler/gs-input-sizing-length-before-layout.geom
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..8c827dc
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length-blocks.geom
@@ -0,0 +1,28 @@
+// 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[];
+
+uniform int foo[inst.length() == 2 ? 1 : -1];
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..ea0d652
--- /dev/null
+++ b/tests/spec/glsl-1.50/compiler/gs-input-sizing-implied-length.geom
@@ -0,0 +1,24 @@
+// 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[];
+
+uniform int foo[Color.length() == 2 ? 1 : -1];
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;
--
1.8.3.4
More information about the Piglit
mailing list