[Piglit] [PATCH] arb_enhanced_layouts: test linking block members for AoA with overlaping locations

Timothy Arceri timothy.arceri at collabora.com
Tue Jan 5 21:51:15 PST 2016


---
 .../block-member-location-overlap-aoa.shader_test  | 62 ++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 tests/spec/arb_enhanced_layouts/linker/block-member-locations/block-member-location-overlap-aoa.shader_test

diff --git a/tests/spec/arb_enhanced_layouts/linker/block-member-locations/block-member-location-overlap-aoa.shader_test b/tests/spec/arb_enhanced_layouts/linker/block-member-locations/block-member-location-overlap-aoa.shader_test
new file mode 100644
index 0000000..42526ab
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/linker/block-member-locations/block-member-location-overlap-aoa.shader_test
@@ -0,0 +1,62 @@
+// From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.50 spec:
+//
+//    "Location aliasing is causing two variables or block members to have the
+//    same location number. Component aliasing is assigning the same (or
+//    overlapping) component numbers for two location aliases. (Recall if
+//    component is not used, components are assigned starting with 0.) With
+//    one exception, location aliasing is allowed only if it does not cause
+//    component aliasing; it is a compile-time or link-time error to cause
+//    component aliasing. Further, when location aliasing, the aliases
+//    sharing the location must have the same underlying numerical type
+//    (floating-point or integer) and the same auxiliary storage and
+//    interpolation qualification."
+
+[require]
+GLSL >= 1.50
+GL_ARB_arrays_of_arrays
+GL_ARB_enhanced_layouts
+GL_ARB_separate_shader_objects
+
+[vertex shader]
+#version 150
+#extension GL_ARB_arrays_of_arrays: require
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+layout(location = 0) out block {
+	vec4 a;
+	layout(location = 1) float f1[2][2];
+	layout(location = 4) float f2; // ERROR: Location 4 used by f1[1][1]
+};
+
+void main()
+{
+	a = vec4(1.0);
+	f1[0][0] = 0.0;
+	f1[0][1] = 0.25;
+	f1[1][0] = 0.5;
+	f1[1][1] = 0.75;
+	f2 = 1.0;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_arrays_of_arrays: require
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+layout(location = 0) in block {
+	vec4 a;
+	layout(location = 1) float f1[2][2];
+	layout(location = 4) float f2; // ERROR: Location 4 used by f1[1][1]
+};
+
+out vec4 color;
+
+void main()
+{
+	color = vec4(f1[0][0] + a.x, f1[1][1] + a.y, f2 + a.z, a.w);
+}
+
+[test]
+link error
-- 
2.4.3



More information about the Piglit mailing list