On Tuesday 19 January 2010 11:38:18 pm Stefan Dösinger wrote: > Am 20.01.2010 um 01:08 schrieb Chris Robinson: > > The comment says that it's using MinZ/MaxZ to suppress depth clipping, > > which could otherwise occur with 0..-1. GL_DEPTH_CLAMP needs to be > > enabled if 'untransformed' is false, to suppress depth clipping as > > intended. > > > > Since the transformed-vertex path is there to bypass transformation and > > frustum clipping, it would make sense to clamp and disable user clip > > planes, too (but as you said, that's not current behavior, so may need to > > be tested; same for viewport clipping). > > I am ok with the patch being committed, as in the worst case this is just a > hack replaced by another hack, and it seems right to me.
>From what I understand, the idea of the patch (map z to 0..-1 with depth- clamp) is correct. It may even fix the issues with HL1 as it will write the correct (unmodified) depth values, and avoid clipping the weapon on the near plane. The problem I see with the patch is, depth-clamping is left to the D3DRS_CLIPPING state which is supposed to be bypassed for transformed vertices. Essentially, if D3DRS_CLIPPING is on and ARB_DEPTH_CLAMP isn't supported, it would use the hack on transformed vertices to attempt to suppress clipping on the near/far planes. If D3DRS_CLIPPING is on and ARB_DEPTH_CLAMP /is/ supported, then it would avoid the hack even though the exact same GL clipping rules are in effect.
