OGL: Depth range inversion.

This commit is contained in:
Jules Blok 2015-05-22 22:42:25 +02:00
parent 88cc91030e
commit e31982474c
3 changed files with 7 additions and 3 deletions

View File

@ -83,7 +83,7 @@ void InitBackendInfo()
g_Config.backend_info.bSupports3DVision = true;
g_Config.backend_info.bSupportsPostProcessing = false;
g_Config.backend_info.bSupportsPaletteConversion = true;
g_Config.backend_info.bSupportsClipControl = true;
g_Config.backend_info.bSupportsClipControl = false;
IDXGIFactory* factory;
IDXGIAdapter* ad;

View File

@ -1245,7 +1245,7 @@ void Renderer::SetViewport()
};
glViewport(iceilf(X), iceilf(Y), iceilf(Width), iceilf(Height));
}
glDepthRangef(GLNear, GLFar);
glDepthRangef(GLFar, GLNear);
}
void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z)

View File

@ -380,6 +380,10 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
//write the true depth value, if the game uses depth textures pixel shaders will override with the correct values
//if not early z culling will improve speed
if (g_ActiveConfig.backend_info.bSupportsClipControl)
{
out.Write("o.pos.z = -o.pos.z;\n");
}
else if (api_type == API_D3D)
{
out.Write("o.pos.z = o.pos.w + o.pos.z;\n");
}
@ -387,7 +391,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
{
// this results in a scale from -1..0 to -1..1 after perspective
// divide
out.Write("o.pos.z = o.pos.w + o.pos.z * 2.0;\n");
out.Write("o.pos.z = o.pos.z * -2.0 - o.pos.w;\n");
// the next steps of the OGL pipeline are:
// (x_c,y_c,z_c,w_c) = o.pos //switch to OGL spec terminology