GS: Reduce false positives in dev overflow errors

This commit is contained in:
refractionpcsx2 2022-06-12 08:03:14 +01:00
parent 200ec5dcfb
commit ce08627396
1 changed files with 7 additions and 3 deletions

View File

@ -3685,10 +3685,14 @@ void GSState::GSTransferBuffer::Init(int tx, int ty, const GIFRegBITBLTBUF& blit
bool GSState::GSTransferBuffer::Update(int tw, int th, int bpp, int& len)
{
u32 packet_size = 0;
u32 tex_size = 0;
if (total == 0)
{
start = end = 0;
total = std::min<int>((tw * bpp >> 3) * th, 1024 * 1024 * 4);
tex_size = (((tw * th * bpp) + 7) >> 3);
packet_size = (tex_size + 15) & ~0xF; // Round up to the nearest quadword
total = std::min<int>(tex_size, 1024 * 1024 * 4);
overflow = false;
}
@ -3696,11 +3700,11 @@ bool GSState::GSTransferBuffer::Update(int tw, int th, int bpp, int& len)
if (len > remaining)
{
if (!overflow)
if (!overflow && len > packet_size)
{
overflow = true;
#if defined(PCSX2_DEVBUILD) || defined(_DEBUG)
Console.Warning("GS transfer buffer overflow");
Console.Warning("GS transfer buffer overflow len %d remaining %d, tex_size %d tw %d th %d bpp %d", len, remaining, tex_size, tw, th, bpp);
#endif
}