[07/10] arb_enhanced_layouts: add component aliasing tests

Submitted by Andres Gomez on Feb. 1, 2019, 5:55 p.m.

Details

Message ID 20190201175524.24454-8-agomez@igalia.com
State Accepted
Commit 93f48c044081179cffac3ff12f307b800bbb5689
Headers show
Series "arb_enhanced_layouts: additional tests" ( rev: 2 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Andres Gomez Feb. 1, 2019, 5:55 p.m.
New tests for component aliasing with duplicated inputs which match
the same output variable in the previous stage.

From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.60 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."

From Section 7.4.1 (Shader Interface Matching) of the OpenGL 4.60 spec:

  "   * An output variable is considered to match an input variable in
        the subsequent shader if:

        – the two variables match in name, type, and qualification,
          and neither has a location qualifier, or

        – the two variables are declared with the same location and
          component layout qualifiers and match in type and
          qualification."

Cc: Timothy Arceri <tarceri@itsqueeze.com>
Cc: Iago Toral Quiroga <itoral@igalia.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Andres Gomez <agomez@igalia.com>
---
 ...uplicated-input-overlap-double.shader_test | 62 +++++++++++++++++++
 ...to-fs-duplicated-input-overlap.shader_test | 59 ++++++++++++++++++
 2 files changed, 121 insertions(+)
 create mode 100644 tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap-double.shader_test
 create mode 100644 tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap.shader_test

Patch hide | download patch | download mbox

diff --git a/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap-double.shader_test b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap-double.shader_test
new file mode 100644
index 000000000..1c9117b9b
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap-double.shader_test
@@ -0,0 +1,62 @@ 
+// From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.60 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."
+//
+// From Section 7.4.1 (Shader Interface Matching) of the OpenGL 4.60 spec:
+//
+//   "   * An output variable is considered to match an input variable
+//         in the subsequent shader if:
+//
+//         – the two variables match in name, type, and qualification,
+//           and neither has a location qualifier, or
+//
+//         – the two variables are declared with the same location and
+//           component layout qualifiers and match in type and
+//           qualification."
+
+[require]
+GLSL >= 1.50
+GL_ARB_enhanced_layouts
+GL_ARB_gpu_shader_fp64
+GL_ARB_separate_shader_objects
+
+[vertex shader]
+#version 150
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_gpu_shader_fp64: require
+#extension GL_ARB_separate_shader_objects: require
+
+// consumes Z/W components
+layout(location = 0, component = 2) flat out double a;
+
+void main()
+{
+  a = 1.0;
+}
+
+[fragment shader]
+#version 150
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_gpu_shader_fp64: require
+#extension GL_ARB_separate_shader_objects: require
+
+out vec4 color;
+
+// consumes Z/W components
+layout(location = 0, component = 2) flat in double b;
+layout(location = 0, component = 2) flat in double c;
+
+void main()
+{
+  color = vec4(c, b, 0.0, 1.0);
+}
+
+[test]
+link error
diff --git a/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap.shader_test b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap.shader_test
new file mode 100644
index 000000000..3dea88a51
--- /dev/null
+++ b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap.shader_test
@@ -0,0 +1,59 @@ 
+// From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.60 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."
+//
+// From Section 7.4.1 (Shader Interface Matching) of the OpenGL 4.60 spec:
+//
+//   "   * An output variable is considered to match an input variable
+//         in the subsequent shader if:
+//
+//         – the two variables match in name, type, and qualification,
+//           and neither has a location qualifier, or
+//
+//         – the two variables are declared with the same location and
+//           component layout qualifiers and match in type and
+//           qualification."
+
+[require]
+GLSL >= 1.40
+GL_ARB_enhanced_layouts
+GL_ARB_separate_shader_objects
+
+[vertex shader]
+#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;
+
+void main()
+{
+  a = vec3(1.0);
+}
+
+[fragment shader]
+#version 140
+#extension GL_ARB_enhanced_layouts: require
+#extension GL_ARB_separate_shader_objects: require
+
+out vec4 color;
+
+// consume Y/Z/W components
+layout(location = 0, component = 1) in vec3 b;
+layout(location = 0, component = 1) in vec3 c;
+
+void main()
+{
+  color = vec4(c.x, b);
+}
+
+[test]
+link error

Comments

On Fri, 2019-02-01 at 19:55 +0200, Andres Gomez wrote:
> New tests for component aliasing with duplicated inputs which match
> the same output variable in the previous stage.
> 
> From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.60 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."
> 
> From Section 7.4.1 (Shader Interface Matching) of the OpenGL 4.60 spec:
> 
>   "   * An output variable is considered to match an input variable in
>         the subsequent shader if:
> 
>         – the two variables match in name, type, and qualification,
>           and neither has a location qualifier, or
> 
>         – the two variables are declared with the same location and
>           component layout qualifiers and match in type and
>           qualification."
> 
> Cc: Timothy Arceri <tarceri@itsqueeze.com>
> Cc: Iago Toral Quiroga <itoral@igalia.com>
> Cc: Ilia Mirkin <imirkin@alum.mit.edu>
> Signed-off-by: Andres Gomez <agomez@igalia.com>

Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>


> ---
>  ...uplicated-input-overlap-double.shader_test | 62 +++++++++++++++++++
>  ...to-fs-duplicated-input-overlap.shader_test | 59 ++++++++++++++++++
>  2 files changed, 121 insertions(+)
>  create mode 100644 tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap-double.shader_test
>  create mode 100644 tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap.shader_test
> 
> diff --git a/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap-double.shader_test b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap-double.shader_test
> new file mode 100644
> index 000000000..1c9117b9b
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap-double.shader_test
> @@ -0,0 +1,62 @@
> +// From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.60 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."
> +//
> +// From Section 7.4.1 (Shader Interface Matching) of the OpenGL 4.60 spec:
> +//
> +//   "   * An output variable is considered to match an input variable
> +//         in the subsequent shader if:
> +//
> +//         – the two variables match in name, type, and qualification,
> +//           and neither has a location qualifier, or
> +//
> +//         – the two variables are declared with the same location and
> +//           component layout qualifiers and match in type and
> +//           qualification."
> +
> +[require]
> +GLSL >= 1.50
> +GL_ARB_enhanced_layouts
> +GL_ARB_gpu_shader_fp64
> +GL_ARB_separate_shader_objects
> +
> +[vertex shader]
> +#version 150
> +#extension GL_ARB_enhanced_layouts: require
> +#extension GL_ARB_gpu_shader_fp64: require
> +#extension GL_ARB_separate_shader_objects: require
> +
> +// consumes Z/W components
> +layout(location = 0, component = 2) flat out double a;
> +
> +void main()
> +{
> +  a = 1.0;
> +}
> +
> +[fragment shader]
> +#version 150
> +#extension GL_ARB_enhanced_layouts: require
> +#extension GL_ARB_gpu_shader_fp64: require
> +#extension GL_ARB_separate_shader_objects: require
> +
> +out vec4 color;
> +
> +// consumes Z/W components
> +layout(location = 0, component = 2) flat in double b;
> +layout(location = 0, component = 2) flat in double c;
> +
> +void main()
> +{
> +  color = vec4(c, b, 0.0, 1.0);
> +}
> +
> +[test]
> +link error
> diff --git a/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap.shader_test b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap.shader_test
> new file mode 100644
> index 000000000..3dea88a51
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/linker/component-layout/vs-to-fs-duplicated-input-overlap.shader_test
> @@ -0,0 +1,59 @@
> +// From Section 4.4.1 (Input Layout Qualifiers) of the GLSL 4.60 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."
> +//
> +// From Section 7.4.1 (Shader Interface Matching) of the OpenGL 4.60 spec:
> +//
> +//   "   * An output variable is considered to match an input variable
> +//         in the subsequent shader if:
> +//
> +//         – the two variables match in name, type, and qualification,
> +//           and neither has a location qualifier, or
> +//
> +//         – the two variables are declared with the same location and
> +//           component layout qualifiers and match in type and
> +//           qualification."
> +
> +[require]
> +GLSL >= 1.40
> +GL_ARB_enhanced_layouts
> +GL_ARB_separate_shader_objects
> +
> +[vertex shader]
> +#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;
> +
> +void main()
> +{
> +  a = vec3(1.0);
> +}
> +
> +[fragment shader]
> +#version 140
> +#extension GL_ARB_enhanced_layouts: require
> +#extension GL_ARB_separate_shader_objects: require
> +
> +out vec4 color;
> +
> +// consume Y/Z/W components
> +layout(location = 0, component = 1) in vec3 b;
> +layout(location = 0, component = 1) in vec3 c;
> +
> +void main()
> +{
> +  color = vec4(c.x, b);
> +}
> +
> +[test]
> +link error