[Piglit] [PATCH 07/10] arb_enhanced_layouts: add component aliasing tests

Juan A. Suarez Romero jasuarez at igalia.com
Wed Mar 20 09:16:25 UTC 2019


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 at itsqueeze.com>
> Cc: Iago Toral Quiroga <itoral at igalia.com>
> Cc: Ilia Mirkin <imirkin at alum.mit.edu>
> Signed-off-by: Andres Gomez <agomez at igalia.com>

Reviewed-by: Juan A. Suarez <jasuarez at 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



More information about the Piglit mailing list