Fixes some depth related test failures listed here: #6243 (closed)
Details of the problem:
Vulkan spec chapter 28.10.1. Depth Clamping and Range Adjustment says that the driver should ignore
depthClampEnable == false. Zink mixes up depth clipping and depth clamping. It doesn't always enable depth clamping which means that the depth range in the viewport was not actually respected.
- Also, when
gl_FragmentDepthis not in the
[0; 1]range and
depthClampEnable == falsethen the depth value is undefined according to the VK spec. Some of the failing tests hit this undefined behaviour here.
- Note that the undefined behaviour allows the Vulkan driver to clamp the depth to
[0; 1](and some drivers do), which make it appear as if Zink were working properly. However, if there were any OpenGL tests which set a different depth range than
glDepthRangethen these would still fail.
The solution I propose here is this:
truein Zink, to ensure the Vulkan driver always respects the viewport
- Make depth clipping independent of depth clamping, use
VK_EXT_depth_clip_enablefor depth clipping.
- Finally, there is also a fix to the Gallium blitter to make sure that the viewport transform it sets doesn't disturb the depth range. (Previously,
0.0in some blits, which was again at the mercy of Vulkan undefined behaviour and would be borken now that depth clamping is always enabled.)