From c404e87226e3b60df26c82738384459abfc649c1 Mon Sep 17 00:00:00 2001 From: degasus Date: Wed, 11 Feb 2015 20:54:15 +0100 Subject: [PATCH] ShaderGen: Fix pixel offset correction We want to move the vertex by 1/12 pixel, but the old code did miss the perspective division. So by multiplying with pos.w, the position is moved correctly after the perspective division. --- Source/Core/VideoCommon/VertexShaderGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp index d1fc126dab..d6f5ac83db 100644 --- a/Source/Core/VideoCommon/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/VertexShaderGen.cpp @@ -383,7 +383,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ // 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_PIXELCENTERCORRECTION".xy;\n"); + out.Write("o.pos.xy = o.pos.xy - o.pos.w * " I_PIXELCENTERCORRECTION".xy;\n"); if (api_type == API_OPENGL) {