summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexShaderGen.cpp
diff options
context:
space:
mode:
authorJules Blok <jules.blok@gmail.com>2016-12-27 20:25:46 +0100
committerJules Blok <jules.blok@gmail.com>2016-12-27 21:32:52 +0100
commitee7a2edf35807689dfeec3d39e6a02c6444d4249 (patch)
tree5e1e29bf278a768db3858dd8667a6f7b318dff5e /Source/Core/VideoCommon/VertexShaderGen.cpp
parent65b5765858e67e12f6648839a49e5cb996ef84fd (diff)
Update comments
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexShaderGen.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp
index 8f44f1735e..8ebcc76257 100644
--- a/Source/Core/VideoCommon/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/VertexShaderGen.cpp
@@ -421,7 +421,8 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const vertex_shader_uid_da
}
// If we can disable the incorrect depth clipping planes using depth clamping, then we can do
- // our own depth clipping and calculate the depth range before the perspective divide.
+ // our own depth clipping and calculate the depth range before the perspective divide if
+ // necessary.
if (g_ActiveConfig.backend_info.bSupportsDepthClamp)
{
// Since we're adjusting z for the depth range before the perspective divide, we have to do our
@@ -435,6 +436,8 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const vertex_shader_uid_da
// Write the true depth value. If the game uses depth textures, then the pixel shader will
// 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,
@@ -448,11 +451,8 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const vertex_shader_uid_da
}
else
{
- // If we can't disable the incorrect depth clipping planes, then we need to rely on the
- // graphics API to handle the depth range after the perspective divide. This can result in
- // inaccurate depth values due to the missing depth bias, but that can be least corrected by
- // overriding depth values in the pixel shader. We still need to take care of the reversed depth
- // though, so we do that here.
+ // 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");
}