[Piglit] [PATCH 1/2] arb_enhanced_layouts: add test for partially overlapping arrays

Ilia Mirkin imirkin at alum.mit.edu
Fri Oct 7 22:06:01 UTC 2016


On Fri, Oct 7, 2016 at 3:56 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> ---
>  .../vs-fs-array-interleave-range.shader_test       | 90 ++++++++++++++++++++++
>  1 file changed, 90 insertions(+)
>  create mode 100644 tests/spec/arb_enhanced_layouts/execution/component-layout/vs-fs-array-interleave-range.shader_test
>
> diff --git a/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-fs-array-interleave-range.shader_test b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-fs-array-interleave-range.shader_test
> new file mode 100644
> index 0000000..70a916e
> --- /dev/null
> +++ b/tests/spec/arb_enhanced_layouts/execution/component-layout/vs-fs-array-interleave-range.shader_test
> @@ -0,0 +1,90 @@
> +# Test for successful interleaving of components in two arrays with different
> +# location ranges between vertex and fragment shaders.
> +
> +[require]
> +GLSL >= 1.40
> +GL_ARB_enhanced_layouts
> +
> +[vertex shader]
> +#version 140
> +#extension GL_ARB_enhanced_layouts: require
> +#extension GL_ARB_separate_shader_objects: require
> +
> +// YZ components of 0..3
> +layout(location = 0, component = 1) out vec2 a[4];
> +
> +// W component of 2..5
> +layout(location = 2, component = 3) out float b[4];
> +
> +// W component of 1
> +layout(location = 1, component = 3) out float c;
> +
> +// X component of 2
> +layout(location = 2, component = 0) out float d;
> +
> +in vec4 piglit_vertex;
> +
> +void main()
> +{
> +  a[0] = vec2(0.0, 1.0);
> +  a[1] = vec2(2.0, 3.0);
> +  a[2] = vec2(4.0, 5.0);
> +  a[3] = vec2(6.0, 7.0);
> +  b[0] = 8.0;
> +  b[1] = 9.0;
> +  b[2] = 10.0;
> +  b[3] = 11.0;
> +  c = 12.0;
> +  d = 13.0;
> +
> +  gl_Position = piglit_vertex;
> +}
> +
> +[fragment shader]
> +#version 140
> +#extension GL_ARB_enhanced_layouts: require
> +#extension GL_ARB_separate_shader_objects: require
> +
> +out vec4 color;
> +
> +// YZ components of 0..3
> +layout(location = 0, component = 1) in vec2 a[4];
> +
> +// W component of 2..5
> +layout(location = 2, component = 3) in float b[4];
> +
> +// W component of 1
> +layout(location = 1, component = 3) in float c;
> +
> +// X component of 2
> +layout(location = 2, component = 0) in float d;
> +
> +void main()
> +{
> +  for (int i = 0; i < 4; ++i) {
> +    if (a[i].x != 2.0 * i) {
> +      color = vec4(1, 0, i * 0.1, a[i].x * 0.1);
> +      return;
> +    }
> +    if (a[i].y != 2.0 * i + 1.0) {
> +      color = vec4(1, 0.25, i * 0.1, a[i].y * 0.1);
> +      return;
> +    }
> +    if (b[i] != 8.0 + float(i)) {
> +      color = vec4(1, 0.5, i * 0.1, b[i] * 0.1);
> +      return;
> +    }
> +  }
> +  if (c != 12.0) {
> +    color = vec4(1, 0.75, 0, c * 0.1);
> +    return;
> +  }
> +  if (d != 13.0) {
> +    color = vec4(1, 1, 0, d * 0.1);

return;

With that (and Dylan's comments addressed), this is Reviewed-by: Ilia
Mirkin <imirkin at alum.mit.edu>

> +  }
> +  color = vec4(0, 1, 0, 1);
> +}
> +
> +[test]
> +draw rect -1 -1 2 2
> +probe all rgba 0 1 0 1
> --
> 2.7.4
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list