diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-01-21 16:27:43 -0300 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2020-01-29 17:53:11 -0300 |
commit | b35449c85d3adabf1a94b253549d8575910f6f8f (patch) | |
tree | 6a25c5cd64cd32f49655fcd8eb5495a2d5061a08 | |
parent | b11aeced18f18b043cc34a3df033766628f3ec83 (diff) |
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.h | 5 |
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: void TickFrame() { ++epoch; while (!pending_destruction.empty()) { - if (pending_destruction.front()->GetEpoch() + 1 > epoch) { + // Delay at least 4 frames before destruction. + // This is due to triple buffering happening on some drivers. + static constexpr u64 epochs_to_destroy = 5; + if (pending_destruction.front()->GetEpoch() + epochs_to_destroy > epoch) { break; } pending_destruction.pop_front(); |