Discover that various games that have black screen problem in nvidia is just caused by having negative zfar or znear values, in ati is not a problem, the drivers can handle it.
This is a test, clamp the values to see if this fix the problem, please test a lot don't know if this breaks something else git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4491 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
78fa929c70
commit
22a0864337
|
@ -610,8 +610,10 @@ void UpdateViewport()
|
||||||
|
|
||||||
// This seems to happen a lot - the above calc is probably wrong.
|
// This seems to happen a lot - the above calc is probably wrong.
|
||||||
if (vp.MinZ < 0.0f) vp.MinZ = 0.0f;
|
if (vp.MinZ < 0.0f) vp.MinZ = 0.0f;
|
||||||
|
if (vp.MinZ > 1.0f) vp.MinZ = 1.0f;
|
||||||
if (vp.MaxZ > 1.0f) vp.MaxZ = 1.0f;
|
if (vp.MaxZ > 1.0f) vp.MaxZ = 1.0f;
|
||||||
|
if (vp.MaxZ < 0.0f) vp.MaxZ = 0.0f;
|
||||||
|
|
||||||
D3D::dev->SetViewport(&vp);
|
D3D::dev->SetViewport(&vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1347,6 +1347,11 @@ void UpdateViewport()
|
||||||
double GLNear = (xfregs.rawViewport[5] - xfregs.rawViewport[2]) / 16777216.0f;
|
double GLNear = (xfregs.rawViewport[5] - xfregs.rawViewport[2]) / 16777216.0f;
|
||||||
double GLFar = xfregs.rawViewport[5] / 16777216.0f;
|
double GLFar = xfregs.rawViewport[5] / 16777216.0f;
|
||||||
|
|
||||||
|
if (GLNear < 0.0f) GLNear = 0.0f;
|
||||||
|
if (GLNear > 1.0f) GLNear = 1.0f;
|
||||||
|
if (GLFar > 1.0f) GLFar = 1.0f;
|
||||||
|
if (GLFar < 0.0f) GLFar = 0.0f;
|
||||||
|
|
||||||
// Update the view port
|
// Update the view port
|
||||||
glViewport(GLx, GLy, GLWidth, GLHeight);
|
glViewport(GLx, GLy, GLWidth, GLHeight);
|
||||||
glDepthRange(GLNear, GLFar);
|
glDepthRange(GLNear, GLFar);
|
||||||
|
|
Loading…
Reference in New Issue