Additional renaming

This commit is contained in:
Henrik Rydgård 2022-08-25 00:19:08 +02:00
parent d0713d7fff
commit 9feb61e7fa

View File

@ -1641,8 +1641,8 @@ bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size,
} }
void FramebufferManagerCommon::FindTransferFramebufferSrc(VirtualFramebuffer *&srcBuffer, u32 basePtr, int stride, int &x, int &y, int &width, int &height, int bpp) { void FramebufferManagerCommon::FindTransferFramebufferSrc(VirtualFramebuffer *&srcBuffer, u32 basePtr, int stride, int &x, int &y, int &width, int &height, int bpp) {
u32 srcYOffset = -1; u32 yOffset = -1;
u32 srcXOffset = -1; u32 xOffset = -1;
int transferWidth = width; int transferWidth = width;
int transferHeight = height; int transferHeight = height;
@ -1659,8 +1659,8 @@ void FramebufferManagerCommon::FindTransferFramebufferSrc(VirtualFramebuffer *&s
if (vfb_address <= basePtr && basePtr < vfb_address + vfb_size) { if (vfb_address <= basePtr && basePtr < vfb_address + vfb_size) {
const u32 byteOffset = basePtr - vfb_address; const u32 byteOffset = basePtr - vfb_address;
const u32 byteStride = stride * bpp; const u32 byteStride = stride * bpp;
const u32 yOffset = byteOffset / byteStride; const u32 memYOffset = byteOffset / byteStride;
bool match = yOffset < srcYOffset && (int)yOffset <= (int)vfb->bufferHeight - height; bool match = memYOffset < yOffset && (int)memYOffset <= (int)vfb->bufferHeight - height;
if (match && vfb_byteStride != byteStride) { if (match && vfb_byteStride != byteStride) {
if (transferWidth != stride || (byteStride * transferHeight != vfb_byteStride && byteStride * transferHeight != vfb_byteWidth)) { if (transferWidth != stride || (byteStride * transferHeight != vfb_byteStride && byteStride * transferHeight != vfb_byteWidth)) {
match = false; match = false;
@ -1673,22 +1673,22 @@ void FramebufferManagerCommon::FindTransferFramebufferSrc(VirtualFramebuffer *&s
height = transferHeight; height = transferHeight;
} }
if (match) { if (match) {
srcYOffset = yOffset; yOffset = memYOffset;
srcXOffset = stride == 0 ? 0 : (byteOffset / bpp) % stride; xOffset = stride == 0 ? 0 : (byteOffset / bpp) % stride;
srcBuffer = vfb; srcBuffer = vfb;
} }
} }
} }
if (srcYOffset != (u32)-1) { if (yOffset != (u32)-1) {
y += srcYOffset; y += yOffset;
x += srcXOffset; x += xOffset;
} }
} }
void FramebufferManagerCommon::FindTransferFramebufferDst(VirtualFramebuffer *&dstBuffer, u32 basePtr, int stride, int &x, int &y, int &width, int &height, int bpp) { void FramebufferManagerCommon::FindTransferFramebufferDst(VirtualFramebuffer *&dstBuffer, u32 basePtr, int stride, int &x, int &y, int &width, int &height, int bpp) {
u32 dstYOffset = -1; u32 yOffset = -1;
u32 dstXOffset = -1; u32 xOffset = -1;
int transferWidth = width; int transferWidth = width;
int transferHeight = height; int transferHeight = height;
@ -1709,12 +1709,12 @@ void FramebufferManagerCommon::FindTransferFramebufferDst(VirtualFramebuffer *&d
if (vfb_address <= basePtr && basePtr < vfb_address + vfb_size) { if (vfb_address <= basePtr && basePtr < vfb_address + vfb_size) {
const u32 byteOffset = basePtr - vfb_address; const u32 byteOffset = basePtr - vfb_address;
const u32 byteStride = stride * bpp; const u32 byteStride = stride * bpp;
const u32 yOffset = byteOffset / byteStride; const u32 memYOffset = byteOffset / byteStride;
// Some games use mismatching bitdepths. But make sure the stride matches. // Some games use mismatching bitdepths. But make sure the stride matches.
// If it doesn't, generally this means we detected the framebuffer with too large a height. // If it doesn't, generally this means we detected the framebuffer with too large a height.
// Use bufferHeight in case of buffers that resize up and down often per frame (Valkyrie Profile.) // Use bufferHeight in case of buffers that resize up and down often per frame (Valkyrie Profile.)
bool match = yOffset < dstYOffset && (int)yOffset <= (int)vfb->bufferHeight - height; bool match = memYOffset < yOffset && (int)memYOffset <= (int)vfb->bufferHeight - height;
if (match && vfb_byteStride != byteStride) { if (match && vfb_byteStride != byteStride) {
// Grand Knights History copies with a mismatching stride but a full line at a time. // Grand Knights History copies with a mismatching stride but a full line at a time.
// Makes it hard to detect the wrong transfers in e.g. God of War. // Makes it hard to detect the wrong transfers in e.g. God of War.
@ -1735,16 +1735,16 @@ void FramebufferManagerCommon::FindTransferFramebufferDst(VirtualFramebuffer *&d
height = transferHeight; height = transferHeight;
} }
if (match) { if (match) {
dstYOffset = yOffset; yOffset = memYOffset;
dstXOffset = stride == 0 ? 0 : (byteOffset / bpp) % stride; xOffset = stride == 0 ? 0 : (byteOffset / bpp) % stride;
dstBuffer = vfb; dstBuffer = vfb;
} }
} }
} }
if (dstYOffset != (u32)-1) { if (yOffset != (u32)-1) {
y += dstYOffset; y += yOffset;
x += dstXOffset; x += xOffset;
} }
} }