mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-03 19:23:47 +01:00
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:
1 parent
7f4da9b567
commit
0956fa3ff6
5 files changed
+9
-5
No files matched your search
@@ -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 {
|
||||
|
||||
@@ -79,9 +79,10 @@ struct VirtualFramebuffer {
|
||||
int last_frame_displayed;
|
||||
int last_frame_clut;
|
||||
int last_frame_failed;
|
||||
int last_frame_depth_updated;
|
||||
int last_frame_depth_render;
|
||||
u32 clutUpdatedBytes;
|
||||
bool memoryUpdated;
|
||||
bool depthUpdated;
|
||||
bool firstFrameSaved;
|
||||
|
||||
u32 fb_address;
|
||||
@@ -283,7 +284,8 @@ public:
|
||||
|
||||
void SetDepthUpdated() {
|
||||
if (currentRenderVfb_) {
|
||||
currentRenderVfb_->depthUpdated = true;
|
||||
currentRenderVfb_->last_frame_depth_render = gpuStats.numFlips;
|
||||
currentRenderVfb_->last_frame_depth_updated = gpuStats.numFlips;
|
||||
}
|
||||
}
|
||||
void SetColorUpdated(int skipDrawReason) {
|
||||
|
||||
@@ -539,6 +539,7 @@ void FramebufferManagerD3D11::BlitFramebufferDepth(VirtualFramebuffer *src, Virt
|
||||
// TODO: Currently, this copies depth AND stencil, which is a problem. See #9740.
|
||||
draw_->CopyFramebufferImage(src->fbo, 0, 0, 0, 0, dst->fbo, 0, 0, 0, 0, src->renderWidth, src->renderHeight, 1, Draw::FB_DEPTH_BIT);
|
||||
RebindFramebuffer();
|
||||
dst->last_frame_depth_updated = gpuStats.numFlips;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -529,7 +529,7 @@ void FramebufferManagerGLES::BlitFramebufferDepth(VirtualFramebuffer *src, Virtu
|
||||
// Let's only do this if not clearing depth.
|
||||
glstate.scissorTest.force(false);
|
||||
draw_->BlitFramebuffer(src->fbo, 0, 0, w, h, dst->fbo, 0, 0, w, h, Draw::FB_DEPTH_BIT, Draw::FB_BLIT_NEAREST);
|
||||
// WARNING: If we set dst->depthUpdated here, our optimization above would be pointless.
|
||||
dst->last_frame_depth_updated = gpuStats.numFlips;
|
||||
glstate.scissorTest.restore();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,6 +412,7 @@ void FramebufferManagerVulkan::BlitFramebufferDepth(VirtualFramebuffer *src, Vir
|
||||
if (matchingDepthBuffer && matchingRenderSize && matchingSize) {
|
||||
// TODO: Currently, this copies depth AND stencil, which is a problem. See #9740.
|
||||
draw_->CopyFramebufferImage(src->fbo, 0, 0, 0, 0, dst->fbo, 0, 0, 0, 0, src->renderWidth, src->renderHeight, 1, Draw::FB_DEPTH_BIT);
|
||||
dst->last_frame_depth_updated = gpuStats.numFlips;
|
||||
} else if (matchingDepthBuffer && matchingSize) {
|
||||
/*
|
||||
int w = std::min(src->renderWidth, dst->renderWidth);
|
||||
|
||||
Reference in new issue
Block a user