[Mesa-dev] [Bug 97231] GL_DEPTH_CLAMP doesn't clamp to the far plane

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Aug 8 21:04:08 UTC 2016


https://bugs.freedesktop.org/show_bug.cgi?id=97231

--- Comment #9 from Jules Blok <jules.blok at gmail.com> ---
(In reply to Roland Scheidegger from comment #8)
> So I think you're doing something unusual. With my earlier quick look, it
> seemed like maybe you're relying on getting the clamped values already as
> fragcoord.z in the shader?

We don't rely on that, we explicitly do our own clamping on gl_FragCoord.z in
the pixel shader.

(In reply to Roland Scheidegger from comment #8)
> If you're using (2^24 - 1) / (2^24) maybe there could also be precision
> issues, albeit I would think it should survive the viewport scaling bits
> (should be right at lsb of the float mantissa).

The reason we're using that specific depth range is so we can prevent round
trip errors by dividing/multiplying all our depth values by a power-of-two
factor. However, we still need to make sure we don't go outside of the 24-bit
integer range hence the strange far value.

What's happening in this specific example is that the game renders a mesh to
clear the screen at depth 2^24 - 1 and then it renders the background at 2^24.
Now, on the system we're trying to emulate the background depth would be
clamped to 2^24 - 1 and thus it will pass an less-equals depth test.

The nvidia blob driver handles this correctly:
https://fifoci.dolphin-emu.org/result/1931730/

The llvmpipe does not: https://fifoci.dolphin-emu.org/compare/1931541-1924723/

And the Intel driver has never been able to pass this test:
https://fifoci.dolphin-emu.org/result/1931392/

On Windows both Nvidia and Intel drivers pass this test.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160808/9a6ac6da/attachment.html>


More information about the mesa-dev mailing list