Add configurable toggle that rounds vertices to the nearest pixel when

w=1.  This fixes some games at higher IRs.
This commit is contained in:
iwubcode
2017-02-18 18:22:41 -06:00
parent 840e58c032
commit a9d08a31a6
9 changed files with 68 additions and 4 deletions

View File

@ -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