Ensure stride in bytes matches FBO up/download.

Even if we should do the copy, we'll currntly use the wrong x/y/w/h.
This fixes incorrect uploads in God of War, which hurt performance a lot.

Unfortunately, in this game there's zero information to tell us the right
size of some small temp framebuffers it uses, so we overestimate their
sizes and the block transfer appears to fall into range.
This commit is contained in:
Unknown W. Brackets
2014-06-07 22:40:41 -07:00
parent 8dbc4078cc
commit 3f8ef6dacd
+8 -4
View File
@@ -2085,8 +2085,11 @@ void FramebufferManager::FindTransferFramebuffers(VirtualFramebuffer *&dstBuffer
const u32 vfb_size = FramebufferByteSize(vfb);
if (vfb_address <= dstBasePtr && dstBasePtr < vfb_address + vfb_size) {
const u32 byteOffset = dstBasePtr - vfb_address;
const u32 yOffset = byteOffset / (dstStride * bpp);
if (yOffset < dstYOffset) {
const u32 byteStride = dstStride * bpp;
const u32 yOffset = byteOffset / byteStride;
// 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 (yOffset < dstYOffset && vfb_size / vfb->height == byteStride) {
dstYOffset = yOffset;
dstXOffset = (byteOffset / bpp) % dstStride;
dstBuffer = vfb;
@@ -2094,8 +2097,9 @@ void FramebufferManager::FindTransferFramebuffers(VirtualFramebuffer *&dstBuffer
}
if (vfb_address <= srcBasePtr && srcBasePtr < vfb_address + vfb_size) {
const u32 byteOffset = srcBasePtr - vfb_address;
const u32 yOffset = byteOffset / (srcStride * bpp);
if (yOffset < srcYOffset) {
const u32 byteStride = srcStride * bpp;
const u32 yOffset = byteOffset / byteStride;
if (yOffset < srcYOffset && vfb_size / vfb->height == byteStride) {
srcYOffset = yOffset;
srcXOffset = (byteOffset / bpp) % srcStride;
srcBuffer = vfb;