[Piglit] [PATCH 5/8] gs: Verify inter-shader checking of input layout vs. implicitly sized arrays.

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


These tests verify that unsized geometry shader input arrays in one
compilation unit are properly sized according to a geometry shader
input layout declaration in another compilation unit, and that a link
error occurs if such sizing would conflict with a static usage of the
array.

v2: Remove gs-input-sizing-length-after-layout.shader_test, since it
is redundant with gs-input-sizing-length-after-layout.geom.
---
 ...layout-consistent-with-static-usage.shader_test | 82 +++++++++++++++++++++
 ...ing-layout-larger-than-static-usage.shader_test | 83 ++++++++++++++++++++++
 ...-layout-conflicts-with-static-usage.shader_test | 61 ++++++++++++++++
 3 files changed, 226 insertions(+)
 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/linker/gs-input-sizing-layout-conflicts-with-static-usage.shader_test

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/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
-- 
1.8.3.4



More information about the Piglit mailing list