From 5803cc441ee272b88f88bdf46127208a757dd514 Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Sat, 20 Nov 2021 05:01:42 +0000 Subject: [PATCH] GS: Improve FixedTEX0 accuracy --- pcsx2/GS/GSDrawingContext.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pcsx2/GS/GSDrawingContext.cpp b/pcsx2/GS/GSDrawingContext.cpp index 2ef5b49b58..19d8146afe 100644 --- a/pcsx2/GS/GSDrawingContext.cpp +++ b/pcsx2/GS/GSDrawingContext.cpp @@ -56,7 +56,7 @@ static int findmax(int tl, int br, int limit, int wm, int minuv, int maxuv) static int reduce(int uv, int size) { - while (size > 3 && (1 << (size - 1)) >= uv + 1) + while (size > 3 && (1 << (size - 1)) >= uv) { size--; } @@ -66,7 +66,7 @@ static int reduce(int uv, int size) static int extend(int uv, int size) { - while (size < 10 && (1 << size) < uv + 1) + while (size < 10 && (1 << size) < uv) { size++; } @@ -99,7 +99,7 @@ GIFRegTEX0 GSDrawingContext::GetSizeFixedTEX0(const GSVector4& st, bool linear, uvf += GSVector4(-0.5f, 0.5f).xxyy(); } - GSVector4i uv = GSVector4i(uvf.floor()); + GSVector4i uv = GSVector4i(uvf.floor().xyzw(uvf.ceil())); uv.x = findmax(uv.x, uv.z, (1 << tw) - 1, wms, minu, maxu); uv.y = findmax(uv.y, uv.w, (1 << th) - 1, wmt, minv, maxv); @@ -154,7 +154,7 @@ void GSDrawingContext::ComputeFixedTEX0(const GSVector4& st) int maxu = (int)CLAMP.MAXU; int maxv = (int)CLAMP.MAXV; - GSVector4i uv = GSVector4i(st.floor()); + GSVector4i uv = GSVector4i(st.floor().xyzw(st.ceil())); uv.x = findmax(uv.x, uv.z, (1 << TEX0.TW) - 1, wms, minu, maxu); uv.y = findmax(uv.y, uv.w, (1 << TEX0.TH) - 1, wmt, minv, maxv);