summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-01-21 16:27:43 -0300
committerGravatar ReinUsesLisp2020-01-29 17:53:11 -0300
commitb35449c85d3adabf1a94b253549d8575910f6f8f (patch)
tree6a25c5cd64cd32f49655fcd8eb5495a2d5061a08
parentMerge pull request #3355 from ReinUsesLisp/break-down (diff)
downloadyuzu-b35449c85d3adabf1a94b253549d8575910f6f8f.tar.gz
yuzu-b35449c85d3adabf1a94b253549d8575910f6f8f.tar.xz
yuzu-b35449c85d3adabf1a94b253549d8575910f6f8f.zip
buffer_cache: Delay buffer destructions
Delay buffer destruction some extra frames to avoid destroying buffers that are still being used from older frames. This happens on Nvidia's driver with mailbox.
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h
index 0510ed777..186aca61d 100644
--- a/src/video_core/buffer_cache/buffer_cache.h
+++ b/src/video_core/buffer_cache/buffer_cache.h
@@ -101,7 +101,10 @@ public:
101 void TickFrame() { 101 void TickFrame() {
102 ++epoch; 102 ++epoch;
103 while (!pending_destruction.empty()) { 103 while (!pending_destruction.empty()) {
104 if (pending_destruction.front()->GetEpoch() + 1 > epoch) { 104 // Delay at least 4 frames before destruction.
105 // This is due to triple buffering happening on some drivers.
106 static constexpr u64 epochs_to_destroy = 5;
107 if (pending_destruction.front()->GetEpoch() + epochs_to_destroy > epoch) {
105 break; 108 break;
106 } 109 }
107 pending_destruction.pop_front(); 110 pending_destruction.pop_front();