new file mode 100644
@@ -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 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
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+in blk1 {
+ vec4 Color;
+} inst1[][2];
+
+in blk2 {
+ vec4 Color;
+} inst2[2][2];
+
+layout(lines) in;
new file mode 100644
@@ -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 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
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+in vec4 Color1[][4];
+in vec4 Color2[2][4];
+layout(lines) in;
new file mode 100644
@@ -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
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+layout(lines) in;
+
+in blk {
+ vec4 Color;
+} inst[][3];
+
+uniform int foo[inst.length() == 2 ? 1 : -1];
+uniform int foo2[inst[1].length() == 3 ? 1 : -1];
new file mode 100644
@@ -0,0 +1,41 @@
+// 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
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+in blk {
+ vec4 Color;
+} inst[][6];
+
+vec4 foo()
+{
+ return inst[2][4].Color;
+}
+
+layout(triangles) in;
new file mode 100644
@@ -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 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
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+in vec4 Color[][4];
+
+vec4 foo()
+{
+ return Color[2][3];
+}
+
+layout(triangles) in;
new file mode 100644
@@ -0,0 +1,41 @@
+// 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
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+in blk {
+ vec4 Color;
+} inst[][2];
+
+vec4 foo()
+{
+ return inst[2][1].Color;
+}
+
+layout(lines) in;
new file mode 100644
@@ -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 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
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+in vec4 Color[][2];
+
+vec4 foo()
+{
+ return Color[2][1];
+}
+
+layout(lines) in;
new file mode 100644
@@ -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
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+layout(lines) in;
+in vec4 Color[][3];
+
+uniform int foo[Color.length() == 2 ? 1 : -1];
+uniform int foo2[Color[1].length() == 3 ? 1 : -1];
new file mode 100644
@@ -0,0 +1,37 @@
+// 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 (for the outer most
+// dimension) causes a compile error.
+// This test verifies the case for input interface blocks.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+in blk1 {
+ vec4 Color;
+} inst2[2][6];
+
+in blk2 {
+ vec4 Color;
+} inst3[3][6];
new file mode 100644
@@ -0,0 +1,21 @@
+// This test verifies that declaring
+// two geometry shader inputs with different array sizes only causes a
+// compile error when the outer most dimension differs.
+//
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+in blk1 {
+ vec4 Color;
+} inst2[2][4];
+
+in blk2 {
+ vec4 Color;
+} inst3[2][5];
new file mode 100644
@@ -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 declaring
+// two geometry shader inputs with different array sizes (for the outer most
+// dimension) causes a compile error.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+in vec4 Color2[2][5];
+in vec4 Color3[3][5];
new file mode 100644
@@ -0,0 +1,16 @@
+// This test verifies that declaring
+// two geometry shader inputs with different array sizes only causes a
+// compile error when the outer most dimension differs.
+//
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+in vec4 Color2[2][4];
+in vec4 Color3[2][3];
new file mode 100644
@@ -0,0 +1,28 @@
+// Verify that geometry shader output arrays of arrays can be declared.
+//
+// [config]
+// expect_result: pass
+// glsl_version: 1.50
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+layout(triangles) in;
+
+in vec4 v1[3];
+
+out vec4 v2[2][4];
+out blk1 {
+ out vec4 v3[2][1];
+};
+out blk2 {
+ out vec4 v[2][5];
+} ifc1;
+out blk3 {
+ out vec4 v;
+} ifc2[2][3];
+out vec4[3] v4[4];
+out vec4[2][3] v5;
new file mode 100644
@@ -0,0 +1,45 @@
+// From section 7.1.1 (Compatibility Profile Built-In Language
+// Variables) of the GLSL 4.10 spec:
+//
+// However, when a built-in interface block with an instance name
+// is redeclared (e.g., gl_in), the instance name must be included
+// in the redeclaration. It is an error to not include the
+// built-in instance name or to change its name. For example,
+//
+// in gl_PerVertex {
+// vec4 gl_ClipVertex;
+// vec4 gl_FrontColor;
+// } gl_in[]; // must be present and must be "gl_in[]"
+//
+// Note: although this text appears in a section referring to
+// compatibility profile variables, it's clear from context that it's
+// meant to apply to any redeclaration of gl_in, whether it is done in
+// a compatibility or a core profile.
+//
+// This appears to be a clarification to the behaviour established for
+// gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version
+// 1.50.
+//
+// In this test, we try redeclaraing the gl_PerVertex input as an
+// array of arrays.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+in gl_PerVertex {
+ vec4 gl_Position;
+} gl_in[][6];
+
+void main()
+{
+}
new file mode 100644
@@ -0,0 +1,45 @@
+// From section 7.1.1 (Compatibility Profile Built-In Language
+// Variables) of the GLSL 4.10 spec:
+//
+// However, when a built-in interface block with an instance name
+// is redeclared (e.g., gl_in), the instance name must be included
+// in the redeclaration. It is an error to not include the
+// built-in instance name or to change its name. For example,
+//
+// in gl_PerVertex {
+// vec4 gl_ClipVertex;
+// vec4 gl_FrontColor;
+// } gl_in[]; // must be present and must be "gl_in[]"
+//
+// Note: although this text appears in a section referring to
+// compatibility profile variables, it's clear from context that it's
+// meant to apply to any redeclaration of gl_in, whether it is done in
+// a compatibility or a core profile.
+//
+// This appears to be a clarification to the behaviour established for
+// gl_PerVertex by GLSL 1.50, therefore we test it using GLSL version
+// 1.50.
+//
+// In this test, we try redeclaraing the gl_PerVertex input as an
+// array of arrays.
+//
+// [config]
+// expect_result: fail
+// glsl_version: 1.50
+// require_extensions: GL_ARB_arrays_of_arrays
+// check_link: false
+// [end config]
+
+#version 150
+#extension GL_ARB_arrays_of_arrays: enable
+
+layout(triangles) in;
+layout(triangle_strip, max_vertices = 3) out;
+
+in gl_PerVertex {
+ vec4 gl_Position;
+} gl_in[3][6];
+
+void main()
+{
+}
V2: Added Nvidia results to commit message Test results are from the following hardware/driver combination: AMD Radeon HD 6670 - Catalyst 13.251 OpenGL 4.3 Nvidia Geforce GTX 570 - 340.24 OpenGL 4.4 The Nvidia results do not always mean what they are intended to (e.g. passing for the wrong reason) as the driver doesn't allow multi dimensional arrays of interface blocks even though the spec says they are allowed. I've indicated these tests with a * gs-input-sizing-consistent-with-prev-length-blocks.geom AMD: pass Nvidia: fail* gs-input-sizing-consistent-with-prev-length.geom AMD: pass Nvidia: pass gs-input-sizing-implied-length-blocks.geom AMD: pass Nvidia: fail gs-input-sizing-implied-length-consistent-with-prev-usage-blocks.geom AMD: pass Nvidia: fail* gs-input-sizing-implied-length-consistent-with-prev-usage.geom AMD: pass Nvidia: pass gs-input-sizing-implied-length-inconsistent-with-prev-usage-blocks.geom AMD: fail Nvidia: pass* gs-input-sizing-implied-length-inconsistent-with-prev-usage.geom AMD: fail Nvidia: fail gs-input-sizing-implied-length.geom AMD: pass Nvidia: fail gs-input-sizing-inconsistent-blocks-invalid.geom AMD: fail Nvidia: pass* gs-input-sizing-inconsistent-blocks-valid.geom AMD: pass Nvidia: fail* gs-input-sizing-inconsistent-invalid.geom AMD: fail Nvidia: pass gs-input-sizing-inconsistent-valid.geom AMD: pass Nvidia: pass gs-output.geom AMD: pass Nvidia: fail* gs-redeclares-pervertex-in-as-array-of-arrays.geom AMD: fail Nvidia: pass* gs-redeclares-pervertex-in-as-array-of-arrays2.geom AMD: fail Nvidia: pass* Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au> --- ...-sizing-consistent-with-prev-length-blocks.geom | 40 +++++++++++++++++++ ...s-input-sizing-consistent-with-prev-length.geom | 33 ++++++++++++++++ .../gs-input-sizing-implied-length-blocks.geom | 31 +++++++++++++++ ...d-length-consistent-with-prev-usage-blocks.geom | 41 ++++++++++++++++++++ ...-implied-length-consistent-with-prev-usage.geom | 38 ++++++++++++++++++ ...length-inconsistent-with-prev-usage-blocks.geom | 41 ++++++++++++++++++++ ...mplied-length-inconsistent-with-prev-usage.geom | 38 ++++++++++++++++++ .../compiler/gs-input-sizing-implied-length.geom | 27 +++++++++++++ ...s-input-sizing-inconsistent-blocks-invalid.geom | 37 ++++++++++++++++++ .../gs-input-sizing-inconsistent-blocks-valid.geom | 21 ++++++++++ .../gs-input-sizing-inconsistent-invalid.geom | 31 +++++++++++++++ .../gs-input-sizing-inconsistent-valid.geom | 16 ++++++++ .../arb_arrays_of_arrays/compiler/gs-output.geom | 28 ++++++++++++++ ...redeclares-pervertex-in-as-array-of-arrays.geom | 45 ++++++++++++++++++++++ ...edeclares-pervertex-in-as-array-of-arrays2.geom | 45 ++++++++++++++++++++++ 15 files changed, 512 insertions(+) create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-input-sizing-consistent-with-prev-length-blocks.geom create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-input-sizing-consistent-with-prev-length.geom create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-input-sizing-implied-length-blocks.geom create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-input-sizing-implied-length-consistent-with-prev-usage-blocks.geom create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-input-sizing-implied-length-consistent-with-prev-usage.geom create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-input-sizing-implied-length-inconsistent-with-prev-usage-blocks.geom create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-input-sizing-implied-length-inconsistent-with-prev-usage.geom create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-input-sizing-implied-length.geom create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-input-sizing-inconsistent-blocks-invalid.geom create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-input-sizing-inconsistent-blocks-valid.geom create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-input-sizing-inconsistent-invalid.geom create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-input-sizing-inconsistent-valid.geom create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-output.geom create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-redeclares-pervertex-in-as-array-of-arrays.geom create mode 100644 tests/spec/arb_arrays_of_arrays/compiler/gs-redeclares-pervertex-in-as-array-of-arrays2.geom