mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-23 02:24:38 +00:00
Handle swapchain recreation (#1830)
This commit is contained in:
parent
94f861588d
commit
400da1aa8d
@ -634,9 +634,11 @@ void Presenter::Present(Frame* frame) {
|
||||
swapchain.Recreate(window.GetWidth(), window.GetHeight());
|
||||
}
|
||||
|
||||
ImGui::Core::NewFrame();
|
||||
if (!swapchain.AcquireNextImage()) {
|
||||
swapchain.Recreate(window.GetWidth(), window.GetHeight());
|
||||
}
|
||||
|
||||
swapchain.AcquireNextImage();
|
||||
ImGui::Core::NewFrame();
|
||||
|
||||
const vk::Image swapchain_image = swapchain.Image();
|
||||
|
||||
@ -731,7 +733,9 @@ void Presenter::Present(Frame* frame) {
|
||||
|
||||
// Present to swapchain.
|
||||
std::scoped_lock submit_lock{Scheduler::submit_mutex};
|
||||
swapchain.Present();
|
||||
if (!swapchain.Present()) {
|
||||
swapchain.Recreate(window.GetWidth(), window.GetHeight());
|
||||
}
|
||||
|
||||
// Free the frame for reuse
|
||||
std::scoped_lock fl{free_mutex};
|
||||
|
@ -112,7 +112,7 @@ bool Swapchain::AcquireNextImage() {
|
||||
return !needs_recreation;
|
||||
}
|
||||
|
||||
void Swapchain::Present() {
|
||||
bool Swapchain::Present() {
|
||||
|
||||
const vk::PresentInfoKHR present_info = {
|
||||
.waitSemaphoreCount = 1,
|
||||
@ -131,6 +131,8 @@ void Swapchain::Present() {
|
||||
}
|
||||
|
||||
frame_index = (frame_index + 1) % image_count;
|
||||
|
||||
return !needs_recreation;
|
||||
}
|
||||
|
||||
void Swapchain::FindPresentFormat() {
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
bool AcquireNextImage();
|
||||
|
||||
/// Presents the current image and move to the next one
|
||||
void Present();
|
||||
bool Present();
|
||||
|
||||
vk::SurfaceKHR GetSurface() const {
|
||||
return surface;
|
||||
|
Loading…
Reference in New Issue
Block a user