Permalink
Browse files

TexCache: Detect textures in FBO gutters.

If it's not even within the framebuffer's bufferWidth, we can just go to
the RAM as normal and skip the FBO.

Fixes #10045.
  • Loading branch information...
unknownbrackets committed Nov 5, 2017
1 parent 2f305f9 commit 7ae451db1fb6dcce317239696ff072e668f48e65
Showing with 8 additions and 0 deletions.
  1. +8 −0 GPU/Common/TextureCacheCommon.cpp
@@ -654,6 +654,7 @@ bool TextureCacheCommon::AttachFramebuffer(TexCacheEntry *entry, u32 address, Vi
const u32 texaddr = ((entry->addr + texaddrOffset) & ~mirrorMask);
const bool noOffset = texaddr == addr;
const bool exactMatch = noOffset && entry->format < 4;
const u32 w = 1 << ((entry->dim >> 0) & 0xf);
const u32 h = 1 << ((entry->dim >> 8) & 0xf);
// 512 on a 272 framebuffer is sane, so let's be lenient.
const u32 minSubareaHeight = h / 4;
@@ -703,6 +704,13 @@ bool TextureCacheCommon::AttachFramebuffer(TexCacheEntry *entry, u32 address, Vi
}
}
// Check if it's in bufferWidth (which might be higher than width and may indicate the framebuffer includes the data.)
if (fbInfo.xOffset >= framebuffer->bufferWidth && fbInfo.xOffset + w <= framebuffer->fb_stride) {
// This happens in Brave Story, see #10045 - the texture is in the space between strides, with matching stride.
DetachFramebuffer(entry, address, framebuffer);
return false;
}
if (fbInfo.yOffset + minSubareaHeight >= framebuffer->height) {
// Can't be inside the framebuffer then, ram. Detach to be safe.
DetachFramebuffer(entry, address, framebuffer);

0 comments on commit 7ae451d

Please sign in to comment.