diff options
| author | Markus Wick <degasus@users.noreply.github.com> | 2017-01-15 23:02:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-15 23:02:13 +0100 |
| commit | 23104b6939079a5153eb52213f771d4157c3bbea (patch) | |
| tree | 4f5a38c6559e1a79d4bb5bfa484d25339e7f26a9 /Source/Core/VideoCommon/VertexShaderGen.cpp | |
| parent | 28f0d8e8a73af1323d3d88b91459911469f2ac1c (diff) | |
| parent | 271a9fe7a900634a1d9aeaf8f03218658fee246a (diff) | |
Merge pull request #4655 from Armada651/vertex-depth-no-uid
VertexShaderGen: Remove the need for an extra UID.
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderGen.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexShaderGen.cpp | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp index 8ebcc76257..49052db9be 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/VertexShaderGen.cpp @@ -30,10 +30,6 @@ VertexShaderUid GetVertexShaderUid() uid_data->msaa = g_ActiveConfig.iMultisamples > 1; uid_data->ssaa = g_ActiveConfig.iMultisamples > 1 && g_ActiveConfig.bSSAA; uid_data->numColorChans = xfmem.numChan.numColorChans; - uid_data->vertex_depth = - g_ActiveConfig.backend_info.bSupportsDepthClamp && - ((fabs(xfmem.viewport.zRange) > 16777215.0f || fabs(xfmem.viewport.farZ) > 16777215.0f) || - (xfmem.viewport.zRange < 0.0f && !g_ActiveConfig.backend_info.bSupportsReversedDepthRange)); GetLightingShaderUid(uid_data->lighting); @@ -438,23 +434,15 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const vertex_shader_uid_da // override it with the correct values if not then early z culling will improve speed. // There are two different ways to do this, when the depth range is oversized, we process // the depth range in the vertex shader, if not we let the host driver handle it. - if (uid_data->vertex_depth) - { - // Adjust z for the depth range. We're using an equation which incorperates a depth inversion, - // so we can map the console -1..0 range to the 0..1 range used in the depth buffer. - // We have to handle the depth range in the vertex shader instead of after the perspective - // divide, because some games will use a depth range larger than what is allowed by the - // graphics API. These large depth ranges will still be clipped to the 0..1 range, so these - // games effectively add a depth bias to the values written to the depth buffer. - out.Write("o.pos.z = o.pos.w * " I_PIXELCENTERCORRECTION ".w - " - "o.pos.z * " I_PIXELCENTERCORRECTION ".z;\n"); - } - else - { - // Here we rely on the host driver to process the depth range, however we still need to invert - // the console -1..0 range to the 0..1 range used in the depth buffer. - out.Write("o.pos.z = -o.pos.z;\n"); - } + // + // Adjust z for the depth range. We're using an equation which incorperates a depth inversion, + // so we can map the console -1..0 range to the 0..1 range used in the depth buffer. + // We have to handle the depth range in the vertex shader instead of after the perspective + // divide, because some games will use a depth range larger than what is allowed by the + // graphics API. These large depth ranges will still be clipped to the 0..1 range, so these + // games effectively add a depth bias to the values written to the depth buffer. + out.Write("o.pos.z = o.pos.w * " I_PIXELCENTERCORRECTION ".w - " + "o.pos.z * " I_PIXELCENTERCORRECTION ".z;\n"); if (!g_ActiveConfig.backend_info.bSupportsClipControl) { |
