<div class="gmail_quote">On Wed, Jul 21, 2010 at 3:54 PM, Keith Whitwell <span dir="ltr"><<a href="mailto:keithw@vmware.com">keithw@vmware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5">On Wed, 2010-07-21 at 01:49 -0700, Marek Olšák wrote:<br>
> Hi,<br>
><br>
> there is a new branch gallium-depth-clamp in the main repository which<br>
> implements ARB_depth_clamp in Gallium. Wine uses this extension to<br>
> disable clipping when it's requested from a D3D9 app, so it's an<br>
> important one.<br>
><br>
> There is a new state "depth_clamp" in pipe_clip_state, and a new cap<br>
> PIPE_CAP_DEPTH_CLAMP. If you think this feature should be mandatory in<br>
> Gallium instead, it's ok with me. There are several reasons I put the<br>
> enable bit in pipe_clip_state, but the most important one is that Z<br>
> clipping must be disabled in hardware first for it to work. It also<br>
> implements depth_clamp handling in cso_cache and wires up<br>
> ARB_depth_clamp in st/mesa.<br>
><br>
> The support in Draw has also been implemented, and both softpipe and<br>
> llvmpipe pass piglit/depth_clamp and piglit/depth-clamp-range.<br>
><br>
> <a href="http://cgit.freedesktop.org/mesa/mesa/log/?h=gallium-depth-clamp" target="_blank">http://cgit.freedesktop.org/mesa/mesa/log/?h=gallium-depth-clamp</a><br>
><br>
> Please review.<br>
><br>
> -Marek<br>
<br>
<br>
</div></div>Marek,<br>
<br>
This looks like a useful change.<br>
<br>
I'm not sure it's actually going go give the expected results for<br>
softpipe/llvmpipe or other users of the path you've put into the draw<br>
module.<br>
<br>
In particular it looks like the spec calls for clamping depth on a<br>
per-pixel basis, where as this is doing it per-vertex.<br>
<br>
The difference is that the spec would allow a triangle with one distant<br>
vertex to hit the far plane and then be clamped to it, whereas your<br>
change means that the triangle as a whole will be altered to be in front<br>
of the depth plane and touch it at one vertex.<br>
<br>
Basically, I think the draw change needs to reduced to just disabling<br>
depth clipping, and (if you like) a clamp(depth, 0, 1) introduced into<br>
softpipe/llvmpipe. Or just don't advertise the cap for<br>
softpipe/llvmpipe.<br></blockquote><div><br></div></div>You're absolutely right. Ok then, I've corrected the Draw changes and committed the patches without advertising the cap for software pipes.<br><br>-Marek<br>