VideoBackends: Set the maximum range when the depth range is oversized.

The depth values generated by the vertex shader need to be clamped correctly.
This commit is contained in:
Jules Blok
2017-02-19 16:41:04 +01:00
parent 51944afa56
commit 28e6e259ed
4 changed files with 36 additions and 14 deletions

View File

@ -481,10 +481,12 @@ void Renderer::SetViewport()
height = -height;
}
// If an inverted depth range is used, which D3D doesn't support,
// we need to calculate the depth range in the vertex shader.
if (xfmem.viewport.zRange < 0.0f)
// If an inverted or oversized depth range is used, we need to calculate the depth range in the
// vertex shader.
if (xfmem.viewport.zRange < 0.0f || fabs(xfmem.viewport.zRange) > 16777215.0f ||
fabs(xfmem.viewport.farZ) > 16777215.0f)
{
// We need to ensure depth values are clamped the maximum value supported by the console GPU.
min_depth = 0.0f;
max_depth = GX_MAX_DEPTH;
}