Add a quick check against bad clut vs depth texture framebuffer matches

See #15828 and #20847
This commit is contained in:
Henrik Rydgård
2026-02-10 15:51:32 +01:00
parent e2b99fc921
commit 5d080d1de8
2 changed files with 11 additions and 4 deletions
+4 -3
View File
@@ -142,15 +142,16 @@ struct VirtualFramebuffer {
// These are mainly used for garbage collection purposes and similar.
// Cannot be used to determine new-ness against a similar other buffer, since they are
// only at frame granularity.
// only at frame granularity. Although, can be used to check for -1 to see if they have ever
// been affected in that way.
int last_frame_used;
int last_frame_attached;
int last_frame_render;
int last_frame_displayed;
int last_frame_clut;
int last_frame_failed;
int last_frame_depth_updated;
int last_frame_depth_render;
int last_frame_depth_updated = -1;
int last_frame_depth_render = -1;
// Convenience methods
inline int WidthInBytes() const { return width * BufferFormatBytesPerPixel(fb_format); }
+7 -1
View File
@@ -1124,7 +1124,13 @@ bool TextureCacheCommon::MatchFramebuffer(
if (!noOffset) {
WARN_LOG_ONCE(subareaClut, Log::G3D, "Matching framebuffer (%s) using %s with offset at %08x +%dx%d", RasterChannelToString(channel), GeTextureFormatToString(entry.format), fb_address, matchInfo->xOffset, matchInfo->yOffset);
}
return true;
if (channel == RasterChannel::RASTER_DEPTH && framebuffer->last_frame_depth_updated < 0) {
// Reject depth textures that have not been rendered to. See #15828
// We're right before the final check here, so we can bail.
return false;
} else {
return true;
}
} else if (IsClutFormat((GETextureFormat)(entry.format)) || IsDXTFormat((GETextureFormat)(entry.format))) {
WARN_LOG_ONCE(fourEightBit, Log::G3D, "%s texture format not matching framebuffer of format %s at %08x/%d", GeTextureFormatToString(entry.format), GeBufferFormatToString(fb_format), fb_address, fb_stride);
return false;