[2/2] arb_arrays_of_arrays: check array sizes when instance name differ

Message ID 1425084165-12569-2-git-send-email-t_arceri@yahoo.com.au
State New
Headers show

Commit Message

'Timothy Arceri' via Patchwork Forward Feb. 28, 2015, 12:42 a.m.
Uniform interface blocks can have different instance names across shaders.
These tests check that array rules are applied correctly.

Test results:

AMD Radeon HD 6670 - Catalyst 14.501.1003 OpenGL 4.4

uniform-block-array-instance-name-mismatch - pass
uniform-block-array-size-and-instance-name-mismatch - fail
---
 ...-block-array-instance-name-mismatch.shader_test | 33 +++++++++++++++++
 ...ray-size-and-instance-name-mismatch.shader_test | 41 ++++++++++++++++++++++
 2 files changed, 74 insertions(+)
 create mode 100644 tests/spec/arb_arrays_of_arrays/linker/uniform-block-array-instance-name-mismatch.shader_test
 create mode 100644 tests/spec/arb_arrays_of_arrays/linker/uniform-block-array-size-and-instance-name-mismatch.shader_test

Patch hide | download patch | download mbox

diff --git a/tests/spec/arb_arrays_of_arrays/linker/uniform-block-array-instance-name-mismatch.shader_test b/tests/spec/arb_arrays_of_arrays/linker/uniform-block-array-instance-name-mismatch.shader_test
new file mode 100644
index 0000000..4ca8e17
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/linker/uniform-block-array-instance-name-mismatch.shader_test
@@ -0,0 +1,33 @@ 
+// Instance names for uniforms can differ check
+// that the shaders link successfully.
+
+[require]
+GLSL >= 1.50
+GL_ARB_arrays_of_arrays
+
+[vertex shader]
+#extension GL_ARB_arrays_of_arrays: enable
+
+uniform Foo {
+  vec4 x;
+} foo[3][4];
+
+void main()
+{
+  gl_Position = vec4(foo[0][1].x);
+}
+
+[fragment shader]
+#extension GL_ARB_arrays_of_arrays: enable
+
+uniform Foo {
+  vec4 x;
+} bar[3][4];
+
+void main()
+{
+  gl_FragColor = bar[0][2].x;
+}
+
+[test]
+link success
diff --git a/tests/spec/arb_arrays_of_arrays/linker/uniform-block-array-size-and-instance-name-mismatch.shader_test b/tests/spec/arb_arrays_of_arrays/linker/uniform-block-array-size-and-instance-name-mismatch.shader_test
new file mode 100644
index 0000000..f3d42fa
--- /dev/null
+++ b/tests/spec/arb_arrays_of_arrays/linker/uniform-block-array-size-and-instance-name-mismatch.shader_test
@@ -0,0 +1,41 @@ 
+// 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 create a uniform block array in both
+// the vertex and fragment shaders, using different array sizes. The
+// instance name of the interface differs across shaders. Then we
+// check that the implementation correctly reported an error.
+
+[require]
+GLSL >= 1.50
+GL_ARB_arrays_of_arrays
+
+[vertex shader]
+#extension GL_ARB_arrays_of_arrays: enable
+
+uniform Foo {
+  vec4 x;
+} foo[2][5];
+
+void main()
+{
+  gl_Position = vec4(foo[0][1].x);
+}
+
+[fragment shader]
+#extension GL_ARB_arrays_of_arrays: enable
+
+uniform Foo {
+  vec4 x;
+} bar[2][4];
+
+void main()
+{
+  gl_FragColor = bar[0][2].x;
+}
+
+[test]
+link error