[Piglit] [PATCH] depth-clamp-range: make sure clamping actually makes a difference

Ilia Mirkin imirkin at alum.mit.edu
Mon Aug 15 02:16:12 UTC 2016


Well, this passes on nouveau (both nv50 and nvc0). And I can confirm
that it fails on llvmpipe, but passes on softpipe. All this depth
stuff always gives me a headache, so might want to wait for someone
who actually gets it to review. But in the meanwhile, here's a

Tested-by: Ilia Mirkin <imirkin at alum.mit.edu>

On Sun, Aug 14, 2016 at 10:08 PM,  <sroland at vmware.com> wrote:
> From: Roland Scheidegger <sroland at vmware.com>
>
> The problem with the chosen depth values was that the depth values
> naturally got viewport-transformed to values below 0.5 (for those
> quads drawn) or above 0.5 (for those not drawn).
> This allowed buggy implementations (in particular llvmpipe) to pass
> the test, even though llvmpipe a) couldn't handle swapped near/far and
> b) didn't actually do any clamping whatsoever in this particular case.
> So change the depth values so that transformed values actually end up
> "on the wrong side" of the depth range.
> ---
>  tests/general/depth-clamp-range.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/tests/general/depth-clamp-range.c b/tests/general/depth-clamp-range.c
> index dd93000..d61d351 100644
> --- a/tests/general/depth-clamp-range.c
> +++ b/tests/general/depth-clamp-range.c
> @@ -89,17 +89,17 @@ piglit_display(void)
>         /* Now, test that near depth clamping works.*/
>         glEnable(GL_DEPTH_CLAMP);
>         glDepthRange(0.25, 1.0);
> -       quad(30, 10, 2); /* 0.25 - drawn. */
> +       quad(30, 10, 4); /* 0.25 - drawn. */
>
>         glDepthRange(0.75, 1.0);
> -       quad(30, 30, 2); /* 0.75 - not drawn. */
> +       quad(30, 30, 4); /* 0.75 - not drawn. */
>
>         /* Test that far clamping works.*/
>         glDepthRange(0.0, 0.25);
> -       quad(50, 10, -2); /* 0.25 - drawn. */
> +       quad(50, 10, -4); /* 0.25 - drawn. */
>
>         glDepthRange(0.0, 0.75);
> -       quad(50, 30, -2); /* 0.75 - not drawn. */
> +       quad(50, 30, -4); /* 0.75 - not drawn. */
>
>         /* Now, flip near and far around and make sure that it's doing the
>          * min/max of near and far in the clamping.
> @@ -107,17 +107,17 @@ piglit_display(void)
>
>         /* Test that near (max) clamping works. */
>         glDepthRange(0.25, 0.0);
> -       quad(70, 10, 2); /* 0.25 - drawn. */
> +       quad(70, 10, 4); /* 0.25 - drawn. */
>
>         glDepthRange(0.75, 0.0);
> -       quad(70, 30, 2); /* 0.75 - not drawn. */
> +       quad(70, 30, 4); /* 0.75 - not drawn. */
>
>         /* Now, test far (min) clamping works. */
>         glDepthRange(1.0, 0.0);
> -       quad(90, 10, -2); /* 0.0 - drawn */
> +       quad(90, 10, -4); /* 0.0 - drawn */
>
>         glDepthRange(1.0, 0.75);
> -       quad(90, 30, -2); /* 0.75 - not drawn*/
> +       quad(90, 30, -4); /* 0.75 - not drawn*/
>
>         pass = piglit_probe_pixel_rgb(15, 15, white) && pass;
>         pass = piglit_probe_pixel_rgb(15, 35, clear) && pass;
> --
> 2.7.4
>


More information about the Piglit mailing list