[Piglit] [PATCH 5/7] arb_enhanced_layouts: test component qualifier for overlaps
Timothy Arceri
t_arceri at yahoo.com.au
Wed Nov 11 14:59:27 PST 2015
From: Timothy Arceri <timothy.arceri at collabora.com>
---
.../compiler/component-layout/overlap-double.vert | 31 ++++++++++++++
.../compiler/component-layout/overlap-illegal.vert | 32 +++++++++++++++
.../compiler/component-layout/overlap-legal.vert | 47 ++++++++++++++++++++++
3 files changed, 110 insertions(+)
create mode 100644 tests/spec/arb_enhanced_layouts/compiler/component-layout/overlap-double.vert
create mode 100644 tests/spec/arb_enhanced_layouts/compiler/component-layout/overlap-illegal.vert
create mode 100644 tests/spec/arb_enhanced_layouts/compiler/component-layout/overlap-legal.vert
diff --git a/tests/spec/arb_enhanced_layouts/compiler/component-layout/overlap-double.vert b/tests/spec/arb_enhanced_layouts/compiler/component-layout/overlap-double.vert
new file mode 100644
index 0000000..255ecdf
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/component-layout/overlap-double.vert
@@ -0,0 +1,31 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// check_link: true
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_gpu_shader_fp64 GL_ARB_separate_shader_objects
+// [end config]
+//
+// 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."
+
+#version 140
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_gpu_shader_fp64: require
+#extension GL_ARB_separate_shader_objects: require
+
+// consume X/Y components
+layout(location = 7, component = 0) out double a;
+
+// consumes Y component
+layout(location = 7, component = 1) out float b;
+
+void main()
+{
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/component-layout/overlap-illegal.vert b/tests/spec/arb_enhanced_layouts/compiler/component-layout/overlap-illegal.vert
new file mode 100644
index 0000000..d7d15e6
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/component-layout/overlap-illegal.vert
@@ -0,0 +1,32 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.40
+// check_link: true
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_separate_shader_objects
+// [end config]
+//
+// 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."
+
+#version 140
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+// consume Y/Z/W components
+layout(location = 0, component = 1) out vec3 a;
+
+// consumes W component
+layout(location = 0, component = 3) out float b;
+
+void main()
+{
+ a = vec3(1.0);
+ b = 0.0;
+}
diff --git a/tests/spec/arb_enhanced_layouts/compiler/component-layout/overlap-legal.vert b/tests/spec/arb_enhanced_layouts/compiler/component-layout/overlap-legal.vert
new file mode 100644
index 0000000..adcbe19
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/compiler/component-layout/overlap-legal.vert
@@ -0,0 +1,47 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.40
+// check_link: true
+// require_extensions: GL_ARB_enhanced_layouts GL_ARB_explicit_attrib_location
+// [end config]
+//
+// 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."
+//
+// ...
+//
+// "The one exception where component aliasing is permitted is for two input
+// variables (not block members) to a vertex shader, which are allowed to
+// have component aliasing. This vertex-variable component aliasing is
+// intended only to support vertex shaders where each execution path
+// accesses at most one input per each aliased component. Implementations
+// are permitted, but not required, to generate link-time errors if they
+// detect that every path through the vertex shader executable accesses
+// multiple inputs aliased to any single component."
+
+#version 140
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_explicit_attrib_location: require
+
+uniform int i;
+
+// consume Y/Z/W components
+layout(location = 0, component = 1) in vec3 a;
+
+// consumes W component
+layout(location = 0, component = 3) in float b;
+
+void main()
+{
+ if (i == 1)
+ gl_Position = vec4(b);
+ else
+ gl_Position = vec4(a, 1.0);
+}
--
2.4.3
More information about the Piglit
mailing list