mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-14 02:45:14 +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());
|
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();
|
const vk::Image swapchain_image = swapchain.Image();
|
||||||
|
|
||||||
|
@ -731,7 +733,9 @@ void Presenter::Present(Frame* frame) {
|
||||||
|
|
||||||
// Present to swapchain.
|
// Present to swapchain.
|
||||||
std::scoped_lock submit_lock{Scheduler::submit_mutex};
|
std::scoped_lock submit_lock{Scheduler::submit_mutex};
|
||||||
swapchain.Present();
|
if (!swapchain.Present()) {
|
||||||
|
swapchain.Recreate(window.GetWidth(), window.GetHeight());
|
||||||
|
}
|
||||||
|
|
||||||
// Free the frame for reuse
|
// Free the frame for reuse
|
||||||
std::scoped_lock fl{free_mutex};
|
std::scoped_lock fl{free_mutex};
|
||||||
|
|
|
@ -112,7 +112,7 @@ bool Swapchain::AcquireNextImage() {
|
||||||
return !needs_recreation;
|
return !needs_recreation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Swapchain::Present() {
|
bool Swapchain::Present() {
|
||||||
|
|
||||||
const vk::PresentInfoKHR present_info = {
|
const vk::PresentInfoKHR present_info = {
|
||||||
.waitSemaphoreCount = 1,
|
.waitSemaphoreCount = 1,
|
||||||
|
@ -131,6 +131,8 @@ void Swapchain::Present() {
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_index = (frame_index + 1) % image_count;
|
frame_index = (frame_index + 1) % image_count;
|
||||||
|
|
||||||
|
return !needs_recreation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Swapchain::FindPresentFormat() {
|
void Swapchain::FindPresentFormat() {
|
||||||
|
|
|
@ -32,7 +32,7 @@ public:
|
||||||
bool AcquireNextImage();
|
bool AcquireNextImage();
|
||||||
|
|
||||||
/// Presents the current image and move to the next one
|
/// Presents the current image and move to the next one
|
||||||
void Present();
|
bool Present();
|
||||||
|
|
||||||
vk::SurfaceKHR GetSurface() const {
|
vk::SurfaceKHR GetSurface() const {
|
||||||
return surface;
|
return surface;
|
||||||
|
|
Loading…
Reference in a new issue