3
0
Fork 0
forked from suyu/suyu

Merge pull request #10151 from GPUCode/no-softlocks-please

Fix softlocks when disabling async present
This commit is contained in:
liamwhite 2023-05-03 10:54:24 -04:00 committed by GitHub
commit ffeb5cdd8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View file

@ -134,7 +134,7 @@ void RendererVulkan::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
Frame* frame = present_manager.GetRenderFrame();
blit_screen.DrawToSwapchain(frame, *framebuffer, use_accelerated, is_srgb);
scheduler.Flush(*frame->render_ready);
scheduler.Record([this, frame](vk::CommandBuffer) { present_manager.PushFrame(frame); });
present_manager.Present(frame);
gpu.RendererFrameEndNotify();
rasterizer.TickFrame();

View file

@ -153,16 +153,19 @@ Frame* PresentManager::GetRenderFrame() {
return frame;
}
void PresentManager::PushFrame(Frame* frame) {
void PresentManager::Present(Frame* frame) {
if (!use_present_thread) {
scheduler.WaitWorker();
CopyToSwapchain(frame);
free_queue.push(frame);
return;
}
std::unique_lock lock{queue_mutex};
present_queue.push(frame);
frame_cv.notify_one();
scheduler.Record([this, frame](vk::CommandBuffer) {
std::unique_lock lock{queue_mutex};
present_queue.push(frame);
frame_cv.notify_one();
});
}
void PresentManager::RecreateFrame(Frame* frame, u32 width, u32 height, bool is_srgb,

View file

@ -45,7 +45,7 @@ public:
Frame* GetRenderFrame();
/// Pushes a frame for presentation
void PushFrame(Frame* frame);
void Present(Frame* frame);
/// Recreates the present frame to match the provided parameters
void RecreateFrame(Frame* frame, u32 width, u32 height, bool is_srgb,