mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[d3d9] Avoid depth degenerate viewports
This commit is contained in:
parent
d221bb7a9c
commit
f2950953e0
@ -5624,12 +5624,16 @@ namespace dxvk {
|
|||||||
// Originally we did this only for powers of two
|
// Originally we did this only for powers of two
|
||||||
// resolutions but since NEAREST filtering fixed to
|
// resolutions but since NEAREST filtering fixed to
|
||||||
// truncate, we need to do this all the time now.
|
// truncate, we need to do this all the time now.
|
||||||
float cf = 0.5f - (1.0f / 128.0f);
|
constexpr float cf = 0.5f - (1.0f / 128.0f);
|
||||||
|
|
||||||
|
// How much to bias MinZ by to avoid a depth
|
||||||
|
// degenerate viewport.
|
||||||
|
constexpr float zBias = 0.001f;
|
||||||
|
|
||||||
viewport = VkViewport{
|
viewport = VkViewport{
|
||||||
float(vp.X) + cf, float(vp.Height + vp.Y) + cf,
|
float(vp.X) + cf, float(vp.Height + vp.Y) + cf,
|
||||||
float(vp.Width), -float(vp.Height),
|
float(vp.Width), -float(vp.Height),
|
||||||
vp.MinZ, vp.MaxZ,
|
vp.MinZ, std::max(vp.MaxZ, vp.MinZ + zBias),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Scissor rectangles. Vulkan does not provide an easy way
|
// Scissor rectangles. Vulkan does not provide an easy way
|
||||||
|
Loading…
x
Reference in New Issue
Block a user