mirror of
https://github.com/citra-emu/citra.git
synced 2024-12-24 06:50:04 +00:00
Remove wait for free buffer
Previously we would first attempt to use any buffer that was free, meaning whichever buffer has already been displayed. This has poor interactions when the operating system throttles the update rate of the window, so if there isn't any free buffers available, just reuse the oldest frame instead.
This commit is contained in:
parent
439d550850
commit
f369196c9f
@ -77,7 +77,6 @@ public:
|
||||
std::scoped_lock lock(swap_chain_lock);
|
||||
std::queue<Frontend::Frame*>().swap(free_queue);
|
||||
present_queue.clear();
|
||||
free_cv.notify_all();
|
||||
present_cv.notify_all();
|
||||
}
|
||||
|
||||
@ -126,10 +125,6 @@ public:
|
||||
|
||||
Frontend::Frame* GetRenderFrame() override {
|
||||
std::unique_lock<std::mutex> lock(swap_chain_lock);
|
||||
// wait for new entries in the free_queue
|
||||
// we want to break at some point to prevent a softlock on close if the presentation thread
|
||||
// stops consuming buffers
|
||||
free_cv.wait_for(lock, std::chrono::milliseconds(100), [&] { return !free_queue.empty(); });
|
||||
|
||||
// If theres no free frames, we will reuse the oldest render frame
|
||||
if (free_queue.empty()) {
|
||||
@ -162,7 +157,6 @@ public:
|
||||
// free the previous frame and add it back to the free queue
|
||||
if (previous_frame) {
|
||||
free_queue.push(previous_frame);
|
||||
free_cv.notify_one();
|
||||
}
|
||||
|
||||
// the newest entries are pushed to the front of the queue
|
||||
@ -172,7 +166,6 @@ public:
|
||||
for (auto f : present_queue) {
|
||||
free_queue.push(f);
|
||||
}
|
||||
free_cv.notify_one();
|
||||
present_queue.clear();
|
||||
previous_frame = frame;
|
||||
return frame;
|
||||
|
Loading…
Reference in New Issue
Block a user