diff mbox

[1/2] glsl-1.50: check array sizes when instance name differ

Message ID 1425084165-12569-1-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. UTC
Uniform interface blocks can have different instance names across shaders. These tests check that array rules are applied correctly.

Test results:

Intel Ivybridge - Mesa 10.6

uniform-block-array-instance-name-mismatch - pass
uniform-block-array-size-and-instance-name-mismatch - pass

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 | 28 +++++++++++++++++
 ...ray-size-and-instance-name-mismatch.shader_test | 36 ++++++++++++++++++++++
 2 files changed, 72 insertions(+)
 create mode 100644 tests/spec/glsl-1.50/linker/uniform-block-array-instance-name-mismatch.shader_test
 create mode 100644 tests/spec/glsl-1.50/linker/uniform-block-array-size-and-instance-name-mismatch.shader_test
diff mbox

Patch

diff --git a/tests/spec/glsl-1.50/linker/uniform-block-array-instance-name-mismatch.shader_test b/tests/spec/glsl-1.50/linker/uniform-block-array-instance-name-mismatch.shader_test
new file mode 100644
index 0000000..b7066a4
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/uniform-block-array-instance-name-mismatch.shader_test
@@ -0,0 +1,28 @@ 
+// Instance names for uniforms can differ. Check
+// that the shaders link successfully.
+
+[require]
+GLSL >= 1.50
+
+[vertex shader]
+uniform Foo {
+  vec4 x;
+} foo[3];
+
+void main()
+{
+  gl_Position = vec4(foo[0].x);
+}
+
+[fragment shader]
+uniform Foo {
+  vec4 x;
+} bar[3];
+
+void main()
+{
+  gl_FragColor = bar[0].x;
+}
+
+[test]
+link success
diff --git a/tests/spec/glsl-1.50/linker/uniform-block-array-size-and-instance-name-mismatch.shader_test b/tests/spec/glsl-1.50/linker/uniform-block-array-size-and-instance-name-mismatch.shader_test
new file mode 100644
index 0000000..f2a7c70
--- /dev/null
+++ b/tests/spec/glsl-1.50/linker/uniform-block-array-size-and-instance-name-mismatch.shader_test
@@ -0,0 +1,36 @@ 
+// 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
+
+[vertex shader]
+uniform Foo {
+  vec4 x;
+} foo[3];
+
+void main()
+{
+  gl_Position = vec4(foo[0].x);
+}
+
+[fragment shader]
+uniform Foo {
+  vec4 x;
+} bar[2];
+
+void main()
+{
+  gl_FragColor = bar[0].x;
+}
+
+[test]
+link error