GS-HW: Correct region size when source is in render target

This commit is contained in:
refractionpcsx2 2023-03-18 14:44:33 +00:00
parent 8b78388834
commit 500b449422
1 changed files with 5 additions and 2 deletions

View File

@ -2220,8 +2220,11 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
// clamp rectangle exceeds the TW/TH (which is now unused), we do need to use it. Timesplitters 2 does
// its frame blending effect using a smaller TW/TH, *and* triangles instead of sprites just to be extra
// annoying.
int tw = region.IsFixedTEX0W(1 << TEX0.TW) ? region.GetWidth() : (1 << TEX0.TW);
int th = region.IsFixedTEX0H(1 << TEX0.TH) ? region.GetHeight() : (1 << TEX0.TH);
// Be careful with offset targets as we can end up sampling the wrong part/not enough, but TW/TH can be nonsense, so we take the biggest one if there is an RT(dst).
// DBZ BT3 uses a region clamp offset when processing 2 player split screen and they set it 1 pixel too wide, meaning this code gets triggered.
// TS2 has junk small TW and TH, but the region makes more sense for the draw.
int tw = std::max(region.IsFixedTEX0W(1 << TEX0.TW) ? static_cast<int>(region.GetWidth()) : (1 << TEX0.TW), dst ? (1 << TEX0.TW) : 0);
int th = std::max(region.IsFixedTEX0H(1 << TEX0.TH) ? static_cast<int>(region.GetHeight()) : (1 << TEX0.TH), dst ? (1 << TEX0.TH) : 0);
int tlevels = 1;
if (lod)