From bf01fd218522c0a427d2aea8368680a482e04126 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 13 Jul 2014 11:59:45 -0700 Subject: [PATCH] Try to avoid false reporting of depthbuf reuse. --- GPU/GLES/Framebuffer.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/GPU/GLES/Framebuffer.cpp b/GPU/GLES/Framebuffer.cpp index 8190df5b2e..3299687890 100644 --- a/GPU/GLES/Framebuffer.cpp +++ b/GPU/GLES/Framebuffer.cpp @@ -1018,22 +1018,31 @@ void FramebufferManager::DoSetRenderFrameBuffer() { // Let's check for depth buffer overlap. Might be interesting. bool sharingReported = false; + bool writingDepth = true; + // Technically, it may write depth later, but we're trying to detect it only when it's really true. + if (gstate.isModeClear()) { + writingDepth = !gstate.isClearModeDepthMask() && gstate.isDepthWriteEnabled(); + } else { + writingDepth = gstate.isDepthWriteEnabled(); + } for (size_t i = 0, end = vfbs_.size(); i < end; ++i) { if (vfbs_[i]->z_stride != 0 && fb_address == vfbs_[i]->z_address) { // If it's clearing it, most likely it just needs more video memory. // Technically it could write something interesting and the other might not clear, but that's not likely. if (!gstate.isModeClear() || !gstate.isClearModeColorMask() || !gstate.isClearModeAlphaMask()) { - WARN_LOG_REPORT(SCEGE, "FBO created from existing depthbuffer as color, %08x/%08x and %08x/%08x", fb_address, z_address, vfbs_[i]->fb_address, vfbs_[i]->z_address); + if (fb_address != z_address && vfbs_[i]->fb_address != vfbs_[i]->z_address) { + WARN_LOG_REPORT(SCEGE, "FBO created from existing depthbuffer as color, %08x/%08x and %08x/%08x", fb_address, z_address, vfbs_[i]->fb_address, vfbs_[i]->z_address); + } } } else if (z_stride != 0 && z_address == vfbs_[i]->fb_address) { // If it's clearing it, then it's probably just the reverse of the above case. - if (!gstate.isModeClear() || !gstate.isClearModeDepthMask()) { + if (writingDepth) { WARN_LOG_REPORT(SCEGE, "FBO using existing buffer as depthbuffer, %08x/%08x and %08x/%08x", fb_address, z_address, vfbs_[i]->fb_address, vfbs_[i]->z_address); } } else if (vfbs_[i]->z_stride != 0 && z_address == vfbs_[i]->z_address && fb_address != vfbs_[i]->fb_address && !sharingReported) { // This happens a lot, but virtually always it's cleared. // It's possible the other might not clear, but when every game is reported it's not useful. - if (!gstate.isModeClear() || !gstate.isClearModeDepthMask()) { + if (writingDepth) { WARN_LOG_REPORT(SCEGE, "FBO reusing depthbuffer, %08x/%08x and %08x/%08x", fb_address, z_address, vfbs_[i]->fb_address, vfbs_[i]->z_address); sharingReported = true; }