diff options
| author | iwubcode <iwubcode@users.noreply.github.com> | 2017-02-18 18:22:41 -0600 |
|---|---|---|
| committer | iwubcode <iwubcode@users.noreply.github.com> | 2017-04-04 09:52:18 -0500 |
| commit | a9d08a31a682484210aae9514b54b0a67f7a44d2 (patch) | |
| tree | 9e76ac8d66479345d15a186a453a87a4e563e11b /Source/Core/VideoCommon/VertexShaderManager.cpp | |
| parent | 840e58c0323b40e96b78962ed784b4f1d7e70c34 (diff) | |
Add configurable toggle that rounds vertices to the nearest pixel when
w=1. This fixes some games at higher IRs.
Diffstat (limited to 'Source/Core/VideoCommon/VertexShaderManager.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/VertexShaderManager.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Source/Core/VideoCommon/VertexShaderManager.cpp b/Source/Core/VideoCommon/VertexShaderManager.cpp index 36bace7426..76a91e0f05 100644 --- a/Source/Core/VideoCommon/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/VertexShaderManager.cpp @@ -382,8 +382,16 @@ void VertexShaderManager::SetConstants() // NOTE: If we ever emulate antialiasing, the sample locations set by // BP registers 0x01-0x04 need to be considered here. const float pixel_center_correction = 7.0f / 12.0f - 0.5f; - const float pixel_size_x = 2.f / g_renderer->EFBToScaledXf(2.f * xfmem.viewport.wd); - const float pixel_size_y = 2.f / g_renderer->EFBToScaledXf(2.f * xfmem.viewport.ht); + const bool bUseVertexRounding = + g_ActiveConfig.bVertexRounding && g_ActiveConfig.iEFBScale != SCALE_1X; + const float viewport_width = bUseVertexRounding ? + (2.f * xfmem.viewport.wd) : + g_renderer->EFBToScaledXf(2.f * xfmem.viewport.wd); + const float viewport_height = bUseVertexRounding ? + (2.f * xfmem.viewport.ht) : + g_renderer->EFBToScaledXf(2.f * xfmem.viewport.ht); + const float pixel_size_x = 2.f / viewport_width; + const float pixel_size_y = 2.f / viewport_height; constants.pixelcentercorrection[0] = pixel_center_correction * pixel_size_x; constants.pixelcentercorrection[1] = pixel_center_correction * pixel_size_y; @@ -391,6 +399,9 @@ void VertexShaderManager::SetConstants() constants.pixelcentercorrection[2] = 1.0f; constants.pixelcentercorrection[3] = 0.0f; + constants.viewport[0] = (2.f * xfmem.viewport.wd); + constants.viewport[1] = (2.f * xfmem.viewport.ht); + if (g_renderer->UseVertexDepthRange()) { // Oversized depth ranges are handled in the vertex shader. We need to reverse |
