mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-26 17:37:03 +00:00
Handle swapchain recreation (#1830)
Some checks are pending
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / reuse (push) Waiting to run
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
Some checks are pending
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / reuse (push) Waiting to run
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
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 a new issue