From 65635b23c1e8575362722c99e6ffdf9d9df64116 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Mon, 14 Dec 2020 03:51:35 +0000 Subject: [PATCH] [d3d9] Always slightly bias viewport, regardless of size Since we got TRUNC_COORD on RADV, we always need to bias this now. Closes: #1854 --- src/d3d9/d3d9_device.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index edca7ad63..d56ab8296 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -5188,15 +5188,12 @@ namespace dxvk { const D3DVIEWPORT9& vp = m_state.viewport; // Correctness Factor for 1/2 texel offset - float cf = 0.5f; - - // HACK: UE3 bug re. tonemapper + shadow sampling being red:- - // We need to bias this, except when it's - // NOT powers of two in order to make - // imprecision biased towards infinity. - if ((vp.Width & (vp.Width - 1)) == 0 - && (vp.Height & (vp.Height - 1)) == 0) - cf -= 1.0f / 128.0f; + // We need to bias this slightly to make + // imprecision in games happy. + // Originally we did this only for powers of two + // resolutions but since NEAREST filtering fixed to + // truncate, we need to do this all the time now. + float cf = 0.5f - (1.0f / 128.0f); viewport = VkViewport{ float(vp.X) + cf, float(vp.Height + vp.Y) + cf,