VertexShaderGen: Use reversed depth range.

This commit is contained in:
Jules Blok
2016-08-06 03:40:45 +02:00
parent e9e81ece65
commit 4582853af4
3 changed files with 8 additions and 5 deletions

View File

@ -405,7 +405,7 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const vertex_shader_uid_da
// We have to handle the depth range in the vertex shader, because some games will use a depth range beyond
// the normal depth range of 0..1.
out.Write("o.pos.z = o.pos.w * " I_PIXELCENTERCORRECTION".w + o.pos.z * " I_PIXELCENTERCORRECTION".z;\n");
out.Write("o.pos.z = o.pos.w * " I_PIXELCENTERCORRECTION".w - o.pos.z * " I_PIXELCENTERCORRECTION".z;\n");
// write the true depth value, if the game uses depth textures pixel shaders will override with
// the correct values
@ -414,7 +414,7 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const vertex_shader_uid_da
{
// this results in a scale from -1..0 to -1..1 after perspective
// divide
out.Write("o.pos.z = o.pos.z * -2.0 - o.pos.w;\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