summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3DBase
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/GraphicsEngineD3DBase
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/GraphicsEngineD3DBase')
-rw-r--r--Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp b/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp
index 18cb8bf0..d2b9387c 100644
--- a/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp
+++ b/Graphics/GraphicsEngineD3DBase/include/SwapChainD3DBase.hpp
@@ -53,7 +53,17 @@ public:
m_FSDesc {FSDesc},
m_Window {Window}
// 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 Direct3D 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;
+ }
~SwapChainD3DBase()
{
@@ -71,6 +81,20 @@ public:
protected:
virtual void UpdateSwapChain(bool CreateNew) = 0;
+ bool Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFORM NewPreTransform, Int32 Dummy = 0 /*To be different from virtual function*/)
+ {
+ if (NewPreTransform != SURFACE_TRANSFORM_OPTIMAL &&
+ NewPreTransform != SURFACE_TRANSFORM_IDENTITY)
+ {
+ LOG_WARNING_MESSAGE(GetSurfaceTransformString(NewPreTransform),
+ " is not an allowed pretransform because Direct3D swap chains only support identity transform. "
+ "Use SURFACE_TRANSFORM_OPTIMAL (recommended) or SURFACE_TRANSFORM_IDENTITY.");
+ }
+ NewPreTransform = SURFACE_TRANSFORM_OPTIMAL;
+
+ return TBase::Resize(NewWidth, NewHeight, NewPreTransform);
+ }
+
void CreateDXGISwapChain(IUnknown* pD3D11DeviceOrD3D12CmdQueue)
{
#if PLATFORM_WIN32
@@ -92,6 +116,11 @@ protected:
}
#endif
+ VERIFY(m_DesiredPreTransform == SURFACE_TRANSFORM_OPTIMAL || m_DesiredPreTransform == SURFACE_TRANSFORM_IDENTITY,
+ "Direct3D swap chains only support identity transform.");
+ m_DesiredPreTransform = SURFACE_TRANSFORM_OPTIMAL;
+ m_SwapChainDesc.PreTransform = SURFACE_TRANSFORM_IDENTITY;
+
auto DXGIColorBuffFmt = TexFormatToDXGI_Format(m_SwapChainDesc.ColorBufferFormat);
DXGI_SWAP_CHAIN_DESC1 swapChainDesc = {};