mirror of https://github.com/PCSX2/pcsx2.git
GS: Fix ReadTexture on unaligned reads
No longer reads out of bounds
This commit is contained in:
parent
59531f005e
commit
8e23d8d557
|
@ -1670,15 +1670,9 @@ void GSLocalMemory::ReadTexture(const GSOffset& off, const GSVector4i& r, u8* ds
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int y = r.top; y < cr.top; y++, dst += dstpitch)
|
u8* crdst = dst;
|
||||||
{
|
|
||||||
for (int x = r.left, i = 0; x < r.right; x++, i++)
|
|
||||||
{
|
|
||||||
((u32*)dst)[i] = (this->*rt)(x, y, TEX0, TEXA);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int y = cr.bottom; y < r.bottom; y++, dst += dstpitch)
|
for (int y = r.top; y < cr.top; y++, dst += dstpitch)
|
||||||
{
|
{
|
||||||
for (int x = r.left, i = 0; x < r.right; x++, i++)
|
for (int x = r.left, i = 0; x < r.right; x++, i++)
|
||||||
{
|
{
|
||||||
|
@ -1699,9 +1693,19 @@ void GSLocalMemory::ReadTexture(const GSOffset& off, const GSVector4i& r, u8* ds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int y = cr.bottom; y < r.bottom; y++, dst += dstpitch)
|
||||||
|
{
|
||||||
|
for (int x = r.left, i = 0; x < r.right; x++, i++)
|
||||||
|
{
|
||||||
|
((u32*)dst)[i] = (this->*rt)(x, y, TEX0, TEXA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!cr.rempty())
|
if (!cr.rempty())
|
||||||
{
|
{
|
||||||
(this->*rtx)(off, cr, dst + (cr.left - r.left) * sizeof(u32), dstpitch, TEXA);
|
crdst += dstpitch * (cr.top - r.top);
|
||||||
|
crdst += sizeof(u32) * (cr.left - r.left);
|
||||||
|
(this->*rtx)(off, cr, crdst, dstpitch, TEXA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue