diff --git a/RenderSystems/Vulkan/src/Windowing/Android/OgreVulkanAndroidWindow.cpp b/RenderSystems/Vulkan/src/Windowing/Android/OgreVulkanAndroidWindow.cpp index 07d4101d34..ca16434dec 100644 --- a/RenderSystems/Vulkan/src/Windowing/Android/OgreVulkanAndroidWindow.cpp +++ b/RenderSystems/Vulkan/src/Windowing/Android/OgreVulkanAndroidWindow.cpp @@ -241,6 +241,11 @@ namespace Ogre if( mClosed || !mNativeWindow ) return; + const uint32 newWidth = static_cast( ANativeWindow_getWidth( mNativeWindow ) ); + const uint32 newHeight = static_cast( ANativeWindow_getHeight( mNativeWindow ) ); + if( newWidth == getWidth() && newHeight == getHeight() && !mRebuildingSwapchain ) + return; + mDevice->stall(); #ifdef OGRE_VULKAN_USE_SWAPPY @@ -285,9 +290,6 @@ namespace Ogre mStencilBuffer->_transitionTo( GpuResidency::OnStorage, (uint8 *)0 ); } - const uint32 newWidth = static_cast( ANativeWindow_getWidth( mNativeWindow ) ); - const uint32 newHeight = static_cast( ANativeWindow_getHeight( mNativeWindow ) ); - setFinalResolution( newWidth, newHeight ); createSwapchain(); diff --git a/RenderSystems/Vulkan/src/Windowing/X11/OgreVulkanXcbWindow.cpp b/RenderSystems/Vulkan/src/Windowing/X11/OgreVulkanXcbWindow.cpp index 7f6e08a56f..7400a37722 100644 --- a/RenderSystems/Vulkan/src/Windowing/X11/OgreVulkanXcbWindow.cpp +++ b/RenderSystems/Vulkan/src/Windowing/X11/OgreVulkanXcbWindow.cpp @@ -517,6 +517,14 @@ namespace Ogre mTop = geom->y; } + auto newWidth = geom->width; + auto newHeight = geom->height; + + free( geom ); + + if( newWidth == getWidth() && newHeight == getHeight() && !mRebuildingSwapchain ) + return; + mDevice->stall(); destroySwapchain(); @@ -527,11 +535,9 @@ namespace Ogre if( mStencilBuffer && mStencilBuffer != mDepthBuffer ) mStencilBuffer->_transitionTo( GpuResidency::OnStorage, (uint8 *)0 ); - setFinalResolution( geom->width, geom->height ); + setFinalResolution( newWidth, newHeight ); createSwapchain(); - - free( geom ); } //------------------------------------------------------------------------- void VulkanXcbWindow::_setVisible( bool visible ) { mVisible = visible; } diff --git a/RenderSystems/Vulkan/src/Windowing/win32/OgreVulkanWin32Window.cpp b/RenderSystems/Vulkan/src/Windowing/win32/OgreVulkanWin32Window.cpp index 6c7206c6e5..351d0009d6 100644 --- a/RenderSystems/Vulkan/src/Windowing/win32/OgreVulkanWin32Window.cpp +++ b/RenderSystems/Vulkan/src/Windowing/win32/OgreVulkanWin32Window.cpp @@ -727,6 +727,9 @@ namespace Ogre updateWindowRect(); + if( mRequestedWidth == getWidth() && mRequestedHeight == getHeight() && !mRebuildingSwapchain ) + return; + mDevice->stall(); destroySwapchain();