[Piglit] [PATCH] Add test for ARB_clip_control v3.

Mathias Fröhlich Mathias.Froehlich at gmx.net
Mon Oct 27 21:27:06 PDT 2014


Hi,

On Sunday, October 26, 2014 03:01:12 Ilia Mirkin wrote:
> > +       /* Back to default */
> > +       glClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
> > +
> > +       /* inside the clip space */
> > +       quad(10, 10, 1.0);
> > +       quad(10, 30, 0.5);
> > +       quad(10, 50, 0.0);
> > +       quad(10, 70, -0.5);
> > +
> > +       /* outside the clip space */
> > +       quad(10, 90, 1.5);
> > +       quad(10, 110, -1.5);
> > +
> > +       /* the written depth value */
> > +       pass = piglit_probe_pixel_depth(15, 15, 0.0) && pass;
> > +       pass = piglit_probe_pixel_depth(15, 35, 0.25) && pass;
> > +       pass = piglit_probe_pixel_depth(15, 55, 0.5) && pass;
> > +       pass = piglit_probe_pixel_depth(15, 75, 0.75) && pass;
> > +
> > +       /* still the clear value */
> > +       pass = piglit_probe_pixel_depth(15, 95, 1.0) && pass;
> > +       pass = piglit_probe_pixel_depth(15, 115, 1.0) && pass;
> 
> Shouldn't you be clearing in between each one?
The quads are different, so there is no direct need.
Also a glClear invalidates a lot of internal state, that is
changing clip control state without clear leads to at
least somehow better testing of the incremental state
invalidation methods.

> > +
> > +
> > +
> > +       glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
> > +
> > +       /* inside the clip space */
> > +       quad(30, 10, 0.0);
> > +       quad(30, 30, -0.25);
> > +       quad(30, 50, -0.5);
> > +       quad(30, 70, -0.75);
> 
> Why are these z-values negative? (Same question below as well...)

The test sets up a orthographic projection and an identity modelview
matrix. Then the eye coordinate system where we specify the vertices
has a positive y axis pointing in the opposite view direction.
glOrtho(... near = -1, far = 1) as called in piglit_ortho_projection
flips the sign of the y axis.
Then with GL_ZERO_TO_ONE and the default glDepthRange(0, 1) the
values from clip space are the same like the ones for the depth buffer.
In this chain: [-1, 0] -> [0, 1] -> [0, 1].

Greetings

Mathias


More information about the Piglit mailing list