mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-21 03:54:45 +00:00
Recreate swapchain if window is resized
This commit is contained in:
parent
74498463a3
commit
161e3fb785
3 changed files with 13 additions and 0 deletions
|
@ -262,6 +262,12 @@ Frame* RendererVulkan::PrepareFrameInternal(VideoCore::Image& image, bool is_eop
|
|||
}
|
||||
|
||||
void RendererVulkan::Present(Frame* frame) {
|
||||
// Recreate the swapchain if the window was resized.
|
||||
if (window.getWidth() != swapchain.GetExtent().width ||
|
||||
window.getHeight() != swapchain.GetExtent().height) {
|
||||
swapchain.Recreate(window.getWidth(), window.getHeight());
|
||||
}
|
||||
|
||||
ImGui::Core::NewFrame();
|
||||
|
||||
swapchain.AcquireNextImage();
|
||||
|
|
|
@ -81,6 +81,10 @@ void Swapchain::Create(u32 width_, u32 height_, vk::SurfaceKHR surface_) {
|
|||
RefreshSemaphores();
|
||||
}
|
||||
|
||||
void Swapchain::Recreate(u32 width_, u32 height_) {
|
||||
Create(width_, height_, surface);
|
||||
}
|
||||
|
||||
bool Swapchain::AcquireNextImage() {
|
||||
vk::Device device = instance.GetDevice();
|
||||
vk::Result result =
|
||||
|
|
|
@ -25,6 +25,9 @@ public:
|
|||
/// Creates (or recreates) the swapchain with a given size.
|
||||
void Create(u32 width, u32 height, vk::SurfaceKHR surface);
|
||||
|
||||
/// Recreates the swapchain with a given size and current surface.
|
||||
void Recreate(u32 width, u32 height);
|
||||
|
||||
/// Acquires the next image in the swapchain.
|
||||
bool AcquireNextImage();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue