diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-04-27 20:29:49 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-04-27 20:29:49 +0000 |
| commit | 5f28d47af17eec8632ea0437066631f2353cecba (patch) | |
| tree | 6b8bcd20fdf4d890d8b914f34d16f1c2f861d097 /Graphics/GraphicsEngineOpenGL | |
| parent | Updated .gitignore (diff) | |
| download | DiligentCore-5f28d47af17eec8632ea0437066631f2353cecba.tar.gz DiligentCore-5f28d47af17eec8632ea0437066631f2353cecba.zip | |
Improved swap chain resize handling on Android
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp | 1 | ||||
| -rw-r--r-- | Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp | 30 |
2 files changed, 29 insertions, 2 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp index c64c41cd..f6308229 100644 --- a/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/DeviceContextGLImpl.cpp @@ -400,6 +400,7 @@ void DeviceContextGLImpl::ResetRenderTargets() { TDeviceContextBase::ResetRenderTargets(); m_IsDefaultFBOBound = false; + m_ContextState.InvalidateFBO(); } diff --git a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp index 3b6ebe8e..420449fb 100644 --- a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp +++ b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp @@ -121,8 +121,34 @@ void SwapChainGLImpl::Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFOR auto* pDeviceGL = m_pRenderDevice.RawPtr<RenderDeviceGLImpl>(); auto& GLContext = pDeviceGL->m_GLContext; GLContext.UpdateScreenSize(); - NewWidth = GLContext.GetScreenWidth(); - NewHeight = GLContext.GetScreenHeight(); + const auto ScreenWidth = GLContext.GetScreenWidth(); + const auto ScreenHeight = GLContext.GetScreenHeight(); + + if (NewWidth == 0) + { + NewWidth = ScreenWidth; + } + else + { + if (NewWidth != ScreenWidth) + { + LOG_WARNING_MESSAGE("Requested new swap chain width (", NewWidth, ") does not match GLES surface width (", ScreenWidth, + "). This may be the result of calling Resize before the rotation has taken the effect."); + } + } + + if (NewHeight == 0) + { + NewHeight = ScreenHeight; + } + else + { + if (NewHeight != ScreenHeight) + { + LOG_WARNING_MESSAGE("Requested new swap chain height (", NewHeight, ") does not match GLES surface height (", ScreenHeight, + "). This may be the result of calling Resize before the rotation has taken the effect."); + } + } #endif TSwapChainGLBase::Resize(NewWidth, NewHeight, NewPreTransform, 0); |
