Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
gsdx-hw: Fix border issue on ComputeFixedTEX0.
It is quite complex to handle rescaling on ComputeFixedTEX0
so this function is less stricter than GetSizeFixedTEX0,
therefore we remove the reduce optimization,
and we don't handle bilinear filtering which might create wrong interpolation at the border.

Fixes FFX upscaling issues on Bilinear filter during cutscenes.

comment
  • Loading branch information
lightningterror committed May 31, 2019
1 parent afd5cee commit 8ff74fc
Showing 1 changed file with 29 additions and 13 deletions.
42 changes: 29 additions & 13 deletions plugins/GSdx/GSDrawingContext.cpp
Expand Up @@ -138,23 +138,39 @@ GIFRegTEX0 GSDrawingContext::GetSizeFixedTEX0(int s_n, const GSVector4& st, bool


void GSDrawingContext::ComputeFixedTEX0(const GSVector4& st, bool linear) void GSDrawingContext::ComputeFixedTEX0(const GSVector4& st, bool linear)
{ {
GIFRegTEX0 reg = GetSizeFixedTEX0(0, st, linear, false); // It is quite complex to handle rescaling so this function is less stricter than GetSizeFixedTEX0,
// therefore we remove the reduce optimization and we don't handle bilinear filtering which might create wrong interpolation at the border.


if(reg.TW > TEX0.TW) int tw = TEX0.TW;
{ int th = TEX0.TH;
m_fixed_tex0 = true;
TEX0.TW = reg.TW; int wms = (int)CLAMP.WMS;
} int wmt = (int)CLAMP.WMT;
if(reg.TH > TEX0.TH)
int minu = (int)CLAMP.MINU;
int minv = (int)CLAMP.MINV;
int maxu = (int)CLAMP.MAXU;
int maxv = (int)CLAMP.MAXV;

GSVector4i uv = GSVector4i(st.floor());

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);

if (wms == CLAMP_REGION_CLAMP || wms == CLAMP_REGION_REPEAT)
tw = extend(uv.x, tw);

if (wmt == CLAMP_REGION_CLAMP || wmt == CLAMP_REGION_REPEAT)
th = extend(uv.y, th);

if ((tw != (int)TEX0.TW) || (th != (int)TEX0.TH))
{ {
m_fixed_tex0 = true; m_fixed_tex0 = true;
TEX0.TH = reg.TH; TEX0.TW = tw;
} TEX0.TH = th;


if(m_fixed_tex0)
{
GL_INS("FixedTEX0 TW %d=>%d, TH %d=>%d wm %d,%d", GL_INS("FixedTEX0 TW %d=>%d, TH %d=>%d wm %d,%d",
(int)stack.TEX0.TW, (int)TEX0.TW, (int)stack.TEX0.TH, (int)TEX0.TH, (int)stack.TEX0.TW, (int)TEX0.TW, (int)stack.TEX0.TH, (int)TEX0.TH,
(int)CLAMP.WMS, (int)CLAMP.WMT); (int)CLAMP.WMS, (int)CLAMP.WMT);
} }
} }

0 comments on commit 8ff74fc

Please sign in to comment.