diff options
| author | Markus Wick <degasus@users.noreply.github.com> | 2017-03-20 10:55:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-20 10:55:56 +0100 |
| commit | 5cc55f0fe3ea261798ca0a48da9dc4d3ccd1059d (patch) | |
| tree | 9aa7b798a5c4745c9f15833b631824ca98182db4 /Source/Core | |
| parent | b35bbdfb58b80f5799ab5d43fcab4b72da7594b2 (diff) | |
| parent | cbfb07152faef81d2b3c34d83b026625d36eb51d (diff) | |
Merge pull request #5096 from Armada651/anything-with-a-viewport
VertexShaderGen: Correct for negative viewport dimensions.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/VideoCommon/VertexShaderGen.cpp | 4 |
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, |
