mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-06 17:32:40 +00:00
Address review comment
This commit is contained in:
parent
5c23a8e012
commit
ccbe410f35
@ -628,6 +628,13 @@ Frame* Presenter::PrepareFrameInternal(VideoCore::ImageId image_id, bool is_eop)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Presenter::Present(Frame* frame) {
|
void Presenter::Present(Frame* frame) {
|
||||||
|
// Free the frame for reuse
|
||||||
|
const auto free_frame = [&] {
|
||||||
|
std::scoped_lock fl{free_mutex};
|
||||||
|
free_queue.push(frame);
|
||||||
|
free_cv.notify_one();
|
||||||
|
};
|
||||||
|
|
||||||
// Recreate the swapchain if the window was resized.
|
// Recreate the swapchain if the window was resized.
|
||||||
if (window.GetWidth() != swapchain.GetExtent().width ||
|
if (window.GetWidth() != swapchain.GetExtent().width ||
|
||||||
window.GetHeight() != swapchain.GetExtent().height) {
|
window.GetHeight() != swapchain.GetExtent().height) {
|
||||||
@ -639,10 +646,7 @@ void Presenter::Present(Frame* frame) {
|
|||||||
if (!swapchain.AcquireNextImage()) {
|
if (!swapchain.AcquireNextImage()) {
|
||||||
// User resizes the window too fast and GPU can't keep up. Skip this frame.
|
// User resizes the window too fast and GPU can't keep up. Skip this frame.
|
||||||
LOG_WARNING(Render_Vulkan, "Skipping frame!");
|
LOG_WARNING(Render_Vulkan, "Skipping frame!");
|
||||||
// Free the frame for reuse
|
free_frame();
|
||||||
std::scoped_lock fl{free_mutex};
|
|
||||||
free_queue.push(frame);
|
|
||||||
free_cv.notify_one();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -751,11 +755,7 @@ void Presenter::Present(Frame* frame) {
|
|||||||
swapchain.Recreate(window.GetWidth(), window.GetHeight());
|
swapchain.Recreate(window.GetWidth(), window.GetHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free the frame for reuse
|
free_frame();
|
||||||
std::scoped_lock fl{free_mutex};
|
|
||||||
free_queue.push(frame);
|
|
||||||
free_cv.notify_one();
|
|
||||||
|
|
||||||
DebugState.IncFlipFrameNum();
|
DebugState.IncFlipFrameNum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user