[Piglit] [PATCH] Check that uniform block link errors are detected when skipping stages.
Paul Berry
stereotype441 at gmail.com
Fri Nov 15 14:03:28 PST 2013
In Mesa, as of commit f38ac41, uniform blocks are only validated
between adjacent shader stages. That means that if a program contains
vertex, geometry, and fragment shader stages, and the vertex and
fragment shader stages refer to a uniform block that isn't referred to
by the geometry stage, then some linker checks may not be performed.
Most possible link errors get detected at a later stage of linking,
but I found one case that wasn't; this test exercises that case.
Test is known to fail with Mesa f38ac41.
---
...e-uniform-block-array-size-mismatch.shader_test | 48 ++++++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 tests/spec/glsl-1.50/linker/skip-stage-uniform-block-array-size-mismatch.shader_test
diff --git a/tests/spec/glsl-1.50/linker/skip-stage-uniform-block-array-size-mismatch.shader_test b/tests/spec/glsl-1.50/linker/skip-stage-uniform-block-array-size-mismatch.shader_test
new file mode 100644
index 0000000..dd83093
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/skip-stage-uniform-block-array-size-mismatch.shader_test
@@ -0,0 +1,48 @@
+// From the GLSL 1.50 spec, section 4.3.7 (Interface Blocks):
+//
+// Furthermore, if a matching block is declared as an array, then
+// the array sizes must also match (or follow array matching rules
+// for the interface between a vertex and a geometry shader).
+//
+// In this test, we deliberately create a uniform block array in both
+// the vertex and fragment shaders, using different array sizes. The
+// geometry shader does not access the uniform block array. Then we
+// check that the implementation correctly reported an error.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+uniform Foo {
+ vec4 x;
+} foo[3];
+
+void main()
+{
+ gl_Position = vec4(foo[0].x);
+}
+
+[geometry shader]
+layout(triangles) in;
+layout(triangle_strip, max_vertices=3) out;
+
+void main()
+{
+ for (int i = 0; i < 3; i++) {
+ gl_Position = gl_in[i].gl_Position;
+ EmitVertex();
+ }
+}
+
+[fragment shader]
+uniform Foo {
+ vec4 x;
+} bar[2];
+
+void main()
+{
+ gl_FragColor = bar[0].x;
+}
+
+[test]
+link error
--
1.8.4.2
More information about the Piglit
mailing list