[Piglit] [PATCH] Add a new shader attachment/link ordering test.

Brian Paul brianp at vmware.com
Mon Jan 26 08:24:39 PST 2015


AFAICT, the GL and GLSL specs don't say anything about the significance
of the order in which shaders are attached to a program object.  For
example, if there's two vertex shader A and B, it shouldn't matter if
they're attached in order A,B or B,A.

This pair of shader tests exercises that.  Both pass with Mesa but
the "b-a" case fails with NVIDIA.
---
 .../glsl-1.20/linker/link-order-a-b.shader_test    | 44 ++++++++++++++++++++++
 .../glsl-1.20/linker/link-order-b-a.shader_test    | 44 ++++++++++++++++++++++
 2 files changed, 88 insertions(+)
 create mode 100644 tests/spec/glsl-1.20/linker/link-order-a-b.shader_test
 create mode 100644 tests/spec/glsl-1.20/linker/link-order-b-a.shader_test

diff --git a/tests/spec/glsl-1.20/linker/link-order-a-b.shader_test b/tests/spec/glsl-1.20/linker/link-order-a-b.shader_test
new file mode 100644
index 0000000..81406f5
--- /dev/null
+++ b/tests/spec/glsl-1.20/linker/link-order-a-b.shader_test
@@ -0,0 +1,44 @@
+# Test linking two vertex shaders.
+# The GLSL and GL specs don't say anything about the order of
+# shaders attached to program objects being significant.
+# So attaching shader 'A' and then attaching shader 'B' should be the
+# same as attaching 'B' then 'A'.
+#
+# Derived from tests/shaders/glsl-link-array-01.shader_test 
+#
+# See also link-order-b-a.shader_test
+
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+// Shader A
+vec4 vals[];
+
+void set_position()
+{
+	gl_Position = vals[1];
+}
+
+[vertex shader]
+// Shader B
+vec4 vals[2];
+
+void set_position();
+
+void main()
+{
+	vals[1] = gl_Vertex;
+	set_position();
+}
+
+
+[fragment shader]
+void main()
+{
+	gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 0.0
diff --git a/tests/spec/glsl-1.20/linker/link-order-b-a.shader_test b/tests/spec/glsl-1.20/linker/link-order-b-a.shader_test
new file mode 100644
index 0000000..24bfa7e
--- /dev/null
+++ b/tests/spec/glsl-1.20/linker/link-order-b-a.shader_test
@@ -0,0 +1,44 @@
+# Test linking two vertex shaders.
+# The GLSL and GL specs don't say anything about the order of
+# shaders attached to program objects being significant.
+# So attaching shader 'A' and then attaching shader 'B' should be the
+# same as attaching 'B' then 'A'.
+#
+# Derived from tests/shaders/glsl-link-array-01.shader_test
+#
+# See also link-order-a-b.shader_test
+
+[require]
+GLSL >= 1.20
+
+[vertex shader]
+// Shader B
+vec4 vals[2];
+
+void set_position();
+
+void main()
+{
+	vals[1] = gl_Vertex;
+	set_position();
+}
+
+[vertex shader]
+// Shader A
+vec4 vals[];
+
+void set_position()
+{
+	gl_Position = vals[1];
+}
+
+
+[fragment shader]
+void main()
+{
+	gl_FragColor = vec4(0.0, 1.0, 0.0, 0.0);
+}
+
+[test]
+draw rect -1 -1 2 2
+probe all rgba 0.0 1.0 0.0 0.0
-- 
1.9.1



More information about the Piglit mailing list