VideoBackends: Clamp depth to uint24 range.

This commit is contained in:
Jules Blok
2015-05-16 21:25:52 +02:00
parent 7e6ec5fa86
commit ef78941042
4 changed files with 7 additions and 9 deletions

View File

@ -1217,8 +1217,8 @@ void Renderer::SetViewport()
float Y = EFBToScaledYf((float)EFB_HEIGHT - xfmem.viewport.yOrig + xfmem.viewport.ht + (float)scissorYOff);
float Width = EFBToScaledXf(2.0f * xfmem.viewport.wd);
float Height = EFBToScaledYf(-2.0f * xfmem.viewport.ht);
float GLNear = (xfmem.viewport.farZ - xfmem.viewport.zRange) / 16777216.0f;
float GLFar = xfmem.viewport.farZ / 16777216.0f;
float GLNear = MathUtil::Clamp<float>(xfmem.viewport.farZ - xfmem.viewport.zRange, 0.0f, 16777215.0f) / 16777216.0f;
float GLFar = MathUtil::Clamp<float>(xfmem.viewport.farZ, 0.0f, 16777215.0f) / 16777216.0f;
if (Width < 0)
{
X += Width;