summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-04-24 03:55:17 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-04-24 03:55:17 +0000
commit5cc8a3953c7986bec781d7c1f8a014195ca4bf6b (patch)
treecd5426ebffc0af628236d45ed70e25969065cab5 /Graphics/GraphicsEngineOpenGL
parentMerge pull request #128 from Dinolek/master (diff)
downloadDiligentCore-5cc8a3953c7986bec781d7c1f8a014195ca4bf6b.tar.gz
DiligentCore-5cc8a3953c7986bec781d7c1f8a014195ca4bf6b.zip
Added surface pretransform parameter to swap chain desc (API 240057)
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/SwapChainGLBase.hpp13
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/SwapChainGLImpl.hpp2
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp15
3 files changed, 25 insertions, 5 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/include/SwapChainGLBase.hpp b/Graphics/GraphicsEngineOpenGL/include/SwapChainGLBase.hpp
index 3fbd81e7..426d30ab 100644
--- a/Graphics/GraphicsEngineOpenGL/include/SwapChainGLBase.hpp
+++ b/Graphics/GraphicsEngineOpenGL/include/SwapChainGLBase.hpp
@@ -55,9 +55,18 @@ public:
virtual ITextureView* DILIGENT_CALL_TYPE GetDepthBufferDSV() override final { return m_pDepthStencilView; }
protected:
- bool Resize(Uint32 NewWidth, Uint32 NewHeight, Int32 /*To be different from virtual function*/)
+ bool Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFORM NewPreTransform, Int32 /*To be different from virtual function*/)
{
- if (TSwapChainBase::Resize(NewWidth, NewHeight, 0))
+ if (NewPreTransform != SURFACE_TRANSFORM_OPTIMAL &&
+ NewPreTransform != SURFACE_TRANSFORM_IDENTITY)
+ {
+ LOG_WARNING_MESSAGE(GetSurfaceTransformString(NewPreTransform),
+ " is not an allowed pretransform because OpenGL swap chains only support identity transform. "
+ "Use SURFACE_TRANSFORM_OPTIMAL (recommended) or SURFACE_TRANSFORM_IDENTITY.");
+ }
+ NewPreTransform = SURFACE_TRANSFORM_OPTIMAL;
+
+ if (TSwapChainBase::Resize(NewWidth, NewHeight, NewPreTransform))
{
if (m_pRenderTargetView)
{
diff --git a/Graphics/GraphicsEngineOpenGL/include/SwapChainGLImpl.hpp b/Graphics/GraphicsEngineOpenGL/include/SwapChainGLImpl.hpp
index f68079eb..8029df2f 100644
--- a/Graphics/GraphicsEngineOpenGL/include/SwapChainGLImpl.hpp
+++ b/Graphics/GraphicsEngineOpenGL/include/SwapChainGLImpl.hpp
@@ -53,7 +53,7 @@ public:
virtual void DILIGENT_CALL_TYPE Present(Uint32 SyncInterval) override final;
/// Implementation of ISwapChain::Resize() in OpenGL backend.
- virtual void DILIGENT_CALL_TYPE Resize(Uint32 NewWidth, Uint32 NewHeight) override final;
+ virtual void DILIGENT_CALL_TYPE Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFORM NewPreTransform) override final;
/// Implementation of ISwapChain::SetFullscreenMode() in OpenGL backend.
virtual void DILIGENT_CALL_TYPE SetFullscreenMode(const DisplayModeAttribs& DisplayMode) override final;
diff --git a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp
index a9af9b5d..3b6ebe8e 100644
--- a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp
@@ -29,6 +29,7 @@
#include "DeviceContextGLImpl.hpp"
#include "RenderDeviceGLImpl.hpp"
#include "SwapChainGLImpl.hpp"
+#include "GraphicsAccessories.hpp"
namespace Diligent
{
@@ -47,6 +48,16 @@ SwapChainGLImpl::SwapChainGLImpl(IReferenceCounters* pRefCounters,
}
// clang-format on
{
+ if (m_DesiredPreTransform != SURFACE_TRANSFORM_OPTIMAL &&
+ m_DesiredPreTransform != SURFACE_TRANSFORM_IDENTITY)
+ {
+ LOG_WARNING_MESSAGE(GetSurfaceTransformString(m_DesiredPreTransform),
+ " is not an allowed pretransform because OpenGL swap chains only support identity transform. "
+ "Use SURFACE_TRANSFORM_OPTIMAL (recommended) or SURFACE_TRANSFORM_IDENTITY.");
+ }
+ m_DesiredPreTransform = SURFACE_TRANSFORM_OPTIMAL;
+ m_SwapChainDesc.PreTransform = SURFACE_TRANSFORM_IDENTITY;
+
#if PLATFORM_WIN32
HWND hWnd = reinterpret_cast<HWND>(InitAttribs.Window.hWnd);
RECT rc;
@@ -104,7 +115,7 @@ void SwapChainGLImpl::Present(Uint32 SyncInterval)
}
}
-void SwapChainGLImpl::Resize(Uint32 NewWidth, Uint32 NewHeight)
+void SwapChainGLImpl::Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFORM NewPreTransform)
{
#if PLATFORM_ANDROID
auto* pDeviceGL = m_pRenderDevice.RawPtr<RenderDeviceGLImpl>();
@@ -114,7 +125,7 @@ void SwapChainGLImpl::Resize(Uint32 NewWidth, Uint32 NewHeight)
NewHeight = GLContext.GetScreenHeight();
#endif
- TSwapChainGLBase::Resize(NewWidth, NewHeight, 0);
+ TSwapChainGLBase::Resize(NewWidth, NewHeight, NewPreTransform, 0);
}
void SwapChainGLImpl::SetFullscreenMode(const DisplayModeAttribs& DisplayMode)