From 72492527e525717ddde2b88677caff5f652d535d Mon Sep 17 00:00:00 2001 From: Anthony Date: Sun, 28 Feb 2021 23:50:45 +1300 Subject: [PATCH] Add D3D9 half-pixel offset Fixes UI rendering issues especially text --- src/core/hle/D3D8/Direct3D9/Direct3D9.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp b/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp index 0243f0664..be99f61ba 100644 --- a/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp +++ b/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp @@ -4197,6 +4197,12 @@ void CxbxUpdateHostViewPortOffsetAndScaleConstants() GetScreenScaleFactors(screenScaleX, screenScaleY); GetMultiSampleOffset(aaOffsetX, aaOffsetY); + // Add D3D9 half-pixel offset (-0.5 given this offset is subtracted) + // We should be able to remove this when off D3D9 + // https://aras-p.info/blog/2016/04/08/solving-dx9-half-pixel-offset/ + aaOffsetX -= 0.5f; + aaOffsetY -= 0.5f; + float xboxScreenspaceWidth = xboxRenderTargetWidth * screenScaleX; float xboxScreenspaceHeight = xboxRenderTargetHeight * screenScaleY;