Restore the clearing optimization, avoiding unnecessary depth copies

This commit is contained in:
Henrik Rydgård committed 2022-08-20 09:46:15 +02:00
1 parent 12db0e52d4
commit 29ea3ffe0c
3 files changed
+8 -5

No files matched your search

+6 -3
View File
@@ -497,13 +497,16 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(const Frame
}
// Called on the first use of depth in a render pass.
void FramebufferManagerCommon::SetDepthFrameBuffer() {
void FramebufferManagerCommon::SetDepthFrameBuffer(bool isClearingDepth) {
if (!currentRenderVfb_) {
return;
}
// "Resolve" the depth buffer, by copying from any overlapping buffers with fresher content.
CopyToDepthFromOverlappingFramebuffers(currentRenderVfb_);
// If this first draw call is anything other than a clear, "resolve" the depth buffer,
// by copying from any overlapping buffers with fresher content.
if (!isClearingDepth) {
CopyToDepthFromOverlappingFramebuffers(currentRenderVfb_);
}
currentRenderVfb_->usageFlags |= FB_USAGE_RENDER_DEPTH;
currentRenderVfb_->depthBindSeq = GetBindSeqCount();