[Piglit] [PATCH] arb_enhanced_layouts: add test for location aliasing with non-numerical type

Iago Toral Quiroga itoral at igalia.com
Mon Nov 6 12:22:39 UTC 2017


This is not allowed so we check that we produce a linker error.
---
 .../vs-to-fs-type-not-numerical.shader_test        | 52 ++++++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-not-numerical.shader_test

diff --git a/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-not-numerical.shader_test b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-not-numerical.shader_test
new file mode 100644
index 000000000..aede6ce8d
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-type-not-numerical.shader_test
@@ -0,0 +1,52 @@
+# Test for link error between vertex and fragment shaders when
+# component qualifiers don't match. This case checks that
+# location aliasing is not permitted for non-numerical types
+# such as a struct
+
+[require]
+GLSL >= 3.30
+GL_ARB_enhanced_layouts
+GL_ARB_separate_shader_objects
+
+[vertex shader]
+#version 330
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+struct S {
+  vec3 foo;
+  vec4 bar;
+};
+
+layout(location = 0, component = 3) out float b;
+layout(location = 0) out S a;
+
+void main()
+{
+  a.foo = vec3(1.0);
+  a.bar = vec4(1.0);
+  b = 0.5;
+}
+
+[fragment shader]
+#version 330
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+struct S {
+  vec3 foo;
+  vec4 bar;
+};
+
+layout(location = 0, component = 3) in float b;
+layout(location = 0) in S a;
+
+out vec4 color;
+
+void main()
+{
+  color = vec4(a.foo + a.bar.xyz, b);
+}
+
+[test]
+link error
-- 
2.11.0



More information about the Piglit mailing list