1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-14 04:29:15 +01:00

[d3d9] Don't scale z to [0, 1] for POSITIONT

I originally thought the depth clipping region was always [0, 1] when I first implemented this nearly 2 years ago.

The depth clipping region is already in the viewport's depth range, so just don't do anything here if we are z-testing.

( We still need to keep the flattening around for when ztest is disabled though :( )

Fixes: #2056
This commit is contained in:
Joshua Ashton 2021-06-06 16:46:50 +01:00 committed by Joshie
parent fe00919d5f
commit f1a9d72d38

View File

@ -6357,22 +6357,15 @@ namespace dxvk {
m_ffZTest = IsZTestEnabled();
float zMin = m_ffZTest ? vp.MinZ : 0.0f;
float zMax = m_ffZTest ? vp.MaxZ : 0.0f;
float zExtent = zMax - zMin;
zExtent = zExtent != 0.0f
? 1.0f / zExtent
: 0.0f;
m_viewportInfo.inverseExtent = Vector4(
2.0f / float(vp.Width),
-2.0f / float(vp.Height),
zExtent,
m_ffZTest ? 1.0f : 0.0f,
1.0f);
m_viewportInfo.inverseOffset = Vector4(
-float(vp.X), -float(vp.Y),
-zMin, 0.0f);
0.0f, 0.0f);
m_viewportInfo.inverseOffset = m_viewportInfo.inverseOffset * m_viewportInfo.inverseExtent;