diff options
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp index 6b577d95..113d1aa3 100644 --- a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp @@ -763,7 +763,35 @@ void SwapChainVkImpl::RecreateVulkanSwapchain(DeviceContextVkImpl* pImmediateCtx void SwapChainVkImpl::Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFORM NewPreTransform) { - if (TSwapChainBase::Resize(NewWidth, NewHeight, NewPreTransform)) + auto RecreateSwapChain = TSwapChainBase::Resize(NewWidth, NewHeight, NewPreTransform); + +#if PLATFORM_ANDROID || PLATFORM_IOS + if (!RecreateSwapChain && m_VkSurface != VK_NULL_HANDLE) + { + // Check orinetation change + const auto* pRenderDeviceVk = m_pRenderDevice.RawPtr<const RenderDeviceVkImpl>(); + const auto& PhysicalDevice = pRenderDeviceVk->GetPhysicalDevice(); + const auto vkDeviceHandle = PhysicalDevice.GetVkDeviceHandle(); + + VkSurfaceCapabilitiesKHR surfCapabilities = {}; + + auto err = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(vkDeviceHandle, m_VkSurface, &surfCapabilities); + if (err == VK_SUCCESS) + { + auto CurrentTransform = VkSurfaceTransformFlagToSurfaceTransform(surfCapabilities.currentTransform); + if (CurrentTransform != m_SwapChainDesc.PreTransform) + { + RecreateSwapChain = true; + } + } + else + { + LOG_ERROR_MESSAGE(err, "Failed to query physical device surface capabilities"); + } + } +#endif + + if (RecreateSwapChain) { auto pDeviceContext = m_wpDeviceContext.Lock(); VERIFY(pDeviceContext, "Immediate context has been released"); |
