[Piglit] [PATCH 2/2] glsl-1.30: add a test that gl_ClipDistance actually affects all primitive types

Marek Olšák maraeo at gmail.com
Wed Dec 21 11:00:09 UTC 2016


For the series:

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Thu, Dec 15, 2016 at 4:38 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> Exposes a bug on radeonsi for the points case.
> ---
>  .../vs-clip-distance-primitives.shader_test        | 68 ++++++++++++++++++++++
>  1 file changed, 68 insertions(+)
>  create mode 100644 tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-primitives.shader_test
>
> diff --git a/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-primitives.shader_test b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-primitives.shader_test
> new file mode 100644
> index 0000000..8191b8d
> --- /dev/null
> +++ b/tests/spec/glsl-1.30/execution/clipping/vs-clip-distance-primitives.shader_test
> @@ -0,0 +1,68 @@
> +# Verify that gl_ClipDistance affects different primitive types correctly.
> +
> +[require]
> +GLSL >= 1.30
> +
> +[vertex shader]
> +#version 130
> +
> +uniform vec2 u_offset;
> +uniform float u_clipdist;
> +
> +out float gl_ClipDistance[1];
> +
> +void main(void)
> +{
> +       gl_Position =
> +               gl_ModelViewProjectionMatrix *
> +               vec4(u_offset.x + (gl_VertexID % 2) * 10,
> +                    u_offset.y + (gl_VertexID / 2) * 10,
> +                    0, 1);
> +
> +       gl_ClipDistance[0] = u_clipdist;
> +}
> +
> +[fragment shader]
> +#version 130
> +
> +void main(void)
> +{
> +       gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
> +}
> +
> +[test]
> +enable GL_CLIP_PLANE0
> +clear color 0.0 0.0 0.0 0.0
> +clear
> +
> +ortho
> +
> +# Test that primitives are clipped with a negative distance
> +uniform float u_clipdist -1
> +
> +uniform vec2 u_offset 0.5 0.5
> +draw arrays GL_POINTS 0 1
> +probe rect rgba ( 0, 0, 20, 20) (0, 0, 0, 0)
> +
> +uniform vec2 u_offset 20 0.5
> +draw arrays GL_LINES 0 2
> +probe rect rgba (20, 0, 20, 20) (0, 0, 0, 0)
> +
> +uniform vec2 u_offset 40 0
> +draw arrays GL_TRIANGLE_STRIP 0 4
> +probe rect rgba (40, 0, 20, 20) (0, 0, 0, 0)
> +
> +# Test that primitives are not clipped with zero distance
> +uniform float u_clipdist 0
> +
> +uniform vec2 u_offset 0.5 20.5
> +draw arrays GL_POINTS 0 1
> +probe rect rgba ( 0, 20, 1, 1) (1, 0, 0, 1)
> +
> +uniform vec2 u_offset 20 20.5
> +draw arrays GL_LINES 0 2
> +probe rect rgba (20, 20, 10, 1) (1, 0, 0, 1)
> +
> +uniform vec2 u_offset 40 20
> +draw arrays GL_TRIANGLE_STRIP 0 4
> +probe rect rgba (40, 20, 10, 10) (1, 0, 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