summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexShaderGen.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2014-04-25 09:32:36 +0200
committerPierre Bourdon <delroth@gmail.com>2014-04-25 09:32:36 +0200
commit25f5598e31d5ce5dca8d1b03888a9205b616280e (patch)
tree8c7450570343948543a276dd5be742a48fdc9a35 /Source/Core/VideoCommon/VertexShaderGen.cpp
parent28db73971733319adfbf25b47e833cbc9510a3a2 (diff)
parentc47c32d4a808218866a9e0a744b0cfa37d6ec9cb (diff)
Merge pull request #306 from neobrain/pixel_center_correction
VertexShaderGen: Correct vertex shader output to consider shifted pixel centers.
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexShaderGen.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp
index 239a2945a3..7d0dc878cd 100644
--- a/Source/Core/VideoCommon/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/VertexShaderGen.cpp
@@ -419,6 +419,14 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
//seems to get rather complicated
}
+ // The console GPU places the pixel center at 7/12 in screen space unless
+ // antialiasing is enabled, while D3D and OpenGL place it at 0.5. This results
+ // in some primitives being placed one pixel too far to the bottom-right,
+ // which in turn can be critical if it happens for clear quads.
+ // Hence, we compensate for this pixel center difference so that primitives
+ // get rasterized correctly.
+ out.Write("o.pos.xy = o.pos.xy - " I_DEPTHPARAMS".zw;\n");
+
if (api_type == API_OPENGL)
{
// Bit ugly here