GPU: Reduce depth blits when not updated.

If the game initially clears the depth in a buffer, but then never uses
that depth again, don't keep blitting depth.

Improves #8538, by preventing the depth blits in this case.
This commit is contained in:
Unknown W. Brackets 2017-12-24 11:52:15 -08:00
parent 7f4da9b567
commit 0956fa3ff6
5 changed files with 9 additions and 5 deletions

View file

@ -440,7 +440,6 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(const Frame
vfb->drawnFormat = params.fmt;
vfb->usageFlags = FB_USAGE_RENDERTARGET;
SetColorUpdated(vfb, skipDrawReason);
vfb->depthUpdated = false;
u32 byteSize = FramebufferByteSize(vfb);
u32 fb_address_mem = (params.fb_address & 0x3FFFFFFF) | 0x04000000;
@ -588,7 +587,8 @@ void FramebufferManagerCommon::NotifyRenderFramebufferSwitched(VirtualFramebuffe
// Copy depth pixel value from the read framebuffer to the draw framebuffer
if (prevVfb && !g_Config.bDisableSlowFramebufEffects) {
if (!prevVfb->fbo || !vfb->fbo || !useBufferedRendering_ || !prevVfb->depthUpdated || isClearingDepth) {
bool hasNewerDepth = prevVfb->last_frame_depth_render != 0 && prevVfb->last_frame_depth_render >= vfb->last_frame_depth_updated;
if (!prevVfb->fbo || !vfb->fbo || !useBufferedRendering_ || !hasNewerDepth || isClearingDepth) {
// If depth wasn't updated, then we're at least "two degrees" away from the data.
// This is an optimization: it probably doesn't need to be copied in this case.
} else {