mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-29 06:43:17 +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) {
|
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();
|
ImGui::Core::NewFrame();
|
||||||
|
|
||||||
swapchain.AcquireNextImage();
|
swapchain.AcquireNextImage();
|
||||||
|
|
|
@ -81,6 +81,10 @@ void Swapchain::Create(u32 width_, u32 height_, vk::SurfaceKHR surface_) {
|
||||||
RefreshSemaphores();
|
RefreshSemaphores();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Swapchain::Recreate(u32 width_, u32 height_) {
|
||||||
|
Create(width_, height_, surface);
|
||||||
|
}
|
||||||
|
|
||||||
bool Swapchain::AcquireNextImage() {
|
bool Swapchain::AcquireNextImage() {
|
||||||
vk::Device device = instance.GetDevice();
|
vk::Device device = instance.GetDevice();
|
||||||
vk::Result result =
|
vk::Result result =
|
||||||
|
|
|
@ -25,6 +25,9 @@ public:
|
||||||
/// Creates (or recreates) the swapchain with a given size.
|
/// Creates (or recreates) the swapchain with a given size.
|
||||||
void Create(u32 width, u32 height, vk::SurfaceKHR surface);
|
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.
|
/// Acquires the next image in the swapchain.
|
||||||
bool AcquireNextImage();
|
bool AcquireNextImage();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue