1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-05 01:24:14 +01:00

[d3d9] Saturate viewport depth range

Viewport depth range in D3D9 is clamped at 0-1, same as OpenGL.

Drivers like RADV, etc support VK_EXT_depth_range_unrestricted,
which makes the regular UB of this actually work -- which isn't what
we want.

We also don't enable VK_EXT_depth_range_unrestricted, so we shouldn't
be setting depth ranges outside of the 0-1 bounds anyway.

Closes: #2960
This commit is contained in:
Joshua Ashton 2022-09-27 18:52:12 -02:30
parent 50857537d6
commit 49854dbfba

View File

@ -5636,7 +5636,8 @@ namespace dxvk {
viewport = VkViewport{
float(vp.X) + cf, float(vp.Height + vp.Y) + cf,
float(vp.Width), -float(vp.Height),
vp.MinZ, std::max(vp.MaxZ, vp.MinZ + zBias),
std::clamp(vp.MinZ, 0.0f, 1.0f),
std::clamp(std::max(vp.MaxZ, vp.MinZ + zBias), 0.0f, 1.0f),
};
// Scissor rectangles. Vulkan does not provide an easy way