summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexShaderGen.cpp
diff options
context:
space:
mode:
authorJules Blok <jules.blok@gmail.com>2017-03-16 12:33:51 +0100
committerJules Blok <jules.blok@gmail.com>2017-03-16 12:34:19 +0100
commitcbfb07152faef81d2b3c34d83b026625d36eb51d (patch)
tree5b3c83d4681f28c3fd2d1bf8d9775bfda6bd459a /Source/Core/VideoCommon/VertexShaderGen.cpp
parentbb708397dbff222fe598950ca16836d60dafc99e (diff)
VertexShaderGen: Correct for negative viewport dimensions.
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderGen.cpp')
-rw-r--r--Source/Core/VideoCommon/VertexShaderGen.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderGen.cpp b/Source/Core/VideoCommon/VertexShaderGen.cpp
index 22aab55bb9..7fc31e1763 100644
--- a/Source/Core/VideoCommon/VertexShaderGen.cpp
+++ b/Source/Core/VideoCommon/VertexShaderGen.cpp
@@ -453,6 +453,10 @@ ShaderCode GenerateVertexShaderCode(APIType api_type, const vertex_shader_uid_da
out.Write("o.pos.z = o.pos.z * 2.0 - o.pos.w;\n");
}
+ // Correct for negative viewports by mirroring all vertices. We need to negate the height here,
+ // since the viewport height is already negated by the render backend.
+ out.Write("o.pos.xy *= sign(" I_PIXELCENTERCORRECTION ".xy * float2(1.0, -1.0));\n");
+
// 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,