<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - GL_DEPTH_CLAMP doesn't clamp to the far plane"
href="https://bugs.freedesktop.org/show_bug.cgi?id=97231#c9">Comment # 9</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - GL_DEPTH_CLAMP doesn't clamp to the far plane"
href="https://bugs.freedesktop.org/show_bug.cgi?id=97231">bug 97231</a>
from <span class="vcard"><a class="email" href="mailto:jules.blok@gmail.com" title="Jules Blok <jules.blok@gmail.com>"> <span class="fn">Jules Blok</span></a>
</span></b>
<pre>(In reply to Roland Scheidegger from <a href="show_bug.cgi?id=97231#c8">comment #8</a>)
<span class="quote">> 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?</span >
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 <a href="show_bug.cgi?id=97231#c8">comment #8</a>)
<span class="quote">> 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).</span >
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:
<a href="https://fifoci.dolphin-emu.org/result/1931730/">https://fifoci.dolphin-emu.org/result/1931730/</a>
The llvmpipe does not: <a href="https://fifoci.dolphin-emu.org/compare/1931541-1924723/">https://fifoci.dolphin-emu.org/compare/1931541-1924723/</a>
And the Intel driver has never been able to pass this test:
<a href="https://fifoci.dolphin-emu.org/result/1931392/">https://fifoci.dolphin-emu.org/result/1931392/</a>
On Windows both Nvidia and Intel drivers pass this test.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>