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

Mathias Fröhlich Mathias.Froehlich at gmx.net
Sat Nov 15 01:02:19 PST 2014

Hi Ilia,

On Friday, November 14, 2014 15:48:46 Ilia Mirkin wrote:
> I don't think I've tested this since v2, but an interesting
> observation is that on nvidia hw, if I force clip_halfz to 0, the v2
> test passed, but if I force it to 1, then some of the things fail.
> Could there be another clipping stage, e.g. viewport, which "fixes"
> things? If so, perhaps you can try to disable/alter it somehow? If
> not, any other ideas as to why the test might be working on nvidia hw?

Probably something get's clipped in window space or the range representable
by the depth buffer:
The clip space to window space transform translates
[clip_space_z_min, clip_space_z_max] -> [0, 1] independent of the
clip spaces z bounds configured from clip control.
If your driver now clips the windows space depth values, you get
that implicitly right.
Well, I have omitted one thing here. The [0, 1] range is only true
if the glDepthRange setting covers the whole [0, 1] range, which
is probably the most often exercised case.
If this driver clips at
[min(gl_DepthRange.near,gl_DepthRange.far), max(gl_DepthRange.near,gl_DepthRange.far)]
then you are probably again fine - at least for the clip control cases.

To get that exactly right in the bigger picture, I have to dig out where exactly
depth clamping happens then if enabled.

IIRC this area with non [0, 1] depth ranges is where both closed
source drivers also disagreed with mesa even with non clip control
cases - that appeared for non standard glDepthRange settings and
the tests I put together for the old original nvidia depth buffer extension.
The glDepthRange values exceeding [0, 1] were unique to that nvidia depth
buffer extension, but the ones not filling the [0, 1] range should be
valid without any of the extensions in question.
But since this is something that failed also independent of the
requested extension, I tried to keep that separate.

But I could see what happens if we set glDepthRange to cover a smaller
range than [0, 1].



More information about the Piglit mailing list