summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
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/GraphicsEngine
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/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/SwapChainBase.hpp19
-rw-r--r--Graphics/GraphicsEngine/interface/APIInfo.h2
-rw-r--r--Graphics/GraphicsEngine/interface/GraphicsTypes.h46
-rw-r--r--Graphics/GraphicsEngine/interface/SwapChain.h10
4 files changed, 66 insertions, 11 deletions
diff --git a/Graphics/GraphicsEngine/include/SwapChainBase.hpp b/Graphics/GraphicsEngine/include/SwapChainBase.hpp
index 8610f0de..181826ac 100644
--- a/Graphics/GraphicsEngine/include/SwapChainBase.hpp
+++ b/Graphics/GraphicsEngine/include/SwapChainBase.hpp
@@ -62,10 +62,11 @@ public:
IDeviceContext* pDeviceContext,
const SwapChainDesc& SCDesc) :
// clang-format off
- TObjectBase {pRefCounters},
- m_pRenderDevice {pDevice },
- m_wpDeviceContext {pDeviceContext},
- m_SwapChainDesc {SCDesc }
+ TObjectBase {pRefCounters },
+ m_pRenderDevice {pDevice },
+ m_wpDeviceContext {pDeviceContext },
+ m_SwapChainDesc {SCDesc },
+ m_DesiredPreTransform{SCDesc.PreTransform}
// clang-format on
{
}
@@ -90,13 +91,16 @@ public:
}
protected:
- bool Resize(Uint32 NewWidth, Uint32 NewHeight, Int32 Dummy = 0 /*To be different from virtual function*/)
+ bool Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFORM NewPreTransform, Int32 Dummy = 0 /*To be different from virtual function*/)
{
if (NewWidth != 0 && NewHeight != 0 &&
- (m_SwapChainDesc.Width != NewWidth || m_SwapChainDesc.Height != NewHeight))
+ (m_SwapChainDesc.Width != NewWidth ||
+ m_SwapChainDesc.Height != NewHeight ||
+ m_DesiredPreTransform != NewPreTransform))
{
m_SwapChainDesc.Width = NewWidth;
m_SwapChainDesc.Height = NewHeight;
+ m_DesiredPreTransform = NewPreTransform;
LOG_INFO_MESSAGE("Resizing the swap chain to ", m_SwapChainDesc.Width, "x", m_SwapChainDesc.Height);
return true;
}
@@ -113,6 +117,9 @@ protected:
/// Swap chain description
SwapChainDesc m_SwapChainDesc;
+
+ /// Desired surface pre-transformation.
+ SURFACE_TRANSFORM m_DesiredPreTransform = SURFACE_TRANSFORM_OPTIMAL;
};
} // namespace Diligent
diff --git a/Graphics/GraphicsEngine/interface/APIInfo.h b/Graphics/GraphicsEngine/interface/APIInfo.h
index 93dec634..390ddeec 100644
--- a/Graphics/GraphicsEngine/interface/APIInfo.h
+++ b/Graphics/GraphicsEngine/interface/APIInfo.h
@@ -30,7 +30,7 @@
/// \file
/// Diligent API information
-#define DILIGENT_API_VERSION 240056
+#define DILIGENT_API_VERSION 240057
#include "../../../Primitives/interface/BasicTypes.h"
diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
index 77d613cd..ccaaeae2 100644
--- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h
+++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
@@ -1223,6 +1223,39 @@ DILIGENT_TYPED_ENUM(SWAP_CHAIN_USAGE_FLAGS, Uint32)
};
DEFINE_FLAG_ENUM_OPERATORS(SWAP_CHAIN_USAGE_FLAGS)
+
+/// The transform applied to the image content prior to presentation.
+DILIGENT_TYPED_ENUM(SURFACE_TRANSFORM, Uint32)
+{
+ /// Uset the most optimal surface transform.
+ SURFACE_TRANSFORM_OPTIMAL = 0,
+
+ /// The image content is presented without being transformed.
+ SURFACE_TRANSFORM_IDENTITY,
+
+ /// The image content is rotated 90 degrees clockwise.
+ SURFACE_TRANSFORM_ROTATE_90,
+
+ /// The image content is rotated 180 degrees clockwise.
+ SURFACE_TRANSFORM_ROTATE_180,
+
+ /// The image content is rotated 270 degrees clockwise.
+ SURFACE_TRANSFORM_ROTATE_270,
+
+ /// The image content is mirrored horizontally.
+ SURFACE_TRANSFORM_HORIZONTAL_MIRROR,
+
+ /// The image content is mirrored horizontally, then rotated 90 degrees clockwise.
+ SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90,
+
+ /// The image content is mirrored horizontally, then rotated 180 degrees clockwise.
+ SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180,
+
+ /// The image content is mirrored horizontally, then rotated 270 degrees clockwise.
+ SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270
+};
+
+
/// Swap chain description
struct SwapChainDesc
{
@@ -1242,6 +1275,19 @@ struct SwapChainDesc
/// Swap chain usage flags. Default value is Diligent::SWAP_CHAIN_USAGE_RENDER_TARGET
SWAP_CHAIN_USAGE_FLAGS Usage DEFAULT_INITIALIZER(SWAP_CHAIN_USAGE_RENDER_TARGET);
+ /// The transform, relative to the presentation engine's natural orientation,
+ /// applied to the image content prior to presentation.
+ ///
+ /// \note When default value (SURFACE_TRANSFORM_OPTIMAL) is used, the engine will
+ /// select the most optimal surface transformation. An application may request
+ /// specific transform (e.g. SURFACE_TRANSFORM_IDENTITY) and the engine will
+ /// try to use that. However, if the transform is not available, the engine will
+ /// select the most optimal transform.
+ /// After the swap chain has been created, this member will contain the actual
+ /// transform selected by the engine and can be queried through ISwapChain::GetDesc()
+ /// method.
+ SURFACE_TRANSFORM PreTransform DEFAULT_INITIALIZER(SURFACE_TRANSFORM_OPTIMAL);
+
/// Number of buffers int the swap chain
Uint32 BufferCount DEFAULT_INITIALIZER(2);
diff --git a/Graphics/GraphicsEngine/interface/SwapChain.h b/Graphics/GraphicsEngine/interface/SwapChain.h
index 2bbefca8..bda7c9f5 100644
--- a/Graphics/GraphicsEngine/interface/SwapChain.h
+++ b/Graphics/GraphicsEngine/interface/SwapChain.h
@@ -64,14 +64,16 @@ DILIGENT_BEGIN_INTERFACE(ISwapChain, IObject)
/// Changes the swap chain's back buffer size
- /// \param [in] NewWidth - New swap chain width, in pixels
- /// \param [in] NewHeight - New swap chain height, in pixels
+ /// \param [in] NewWidth - New swap chain width, in pixels.
+ /// \param [in] NewHeight - New swap chain height, in pixels.
+ /// \param [in] NewTransform - New surface transform, see Diligent::SURFACE_TRANSFORM.
///
/// \note When resizing non-primary swap chains, the engine unbinds the
/// swap chain buffers from the output.
VIRTUAL void METHOD(Resize)(THIS_
- Uint32 NewWidth,
- Uint32 NewHeight) PURE;
+ Uint32 NewWidth,
+ Uint32 NewHeight,
+ SURFACE_TRANSFORM NewTransform DEFAULT_VALUE(SURFACE_TRANSFORM_OPTIMAL)) PURE;
/// Sets fullscreen mode (only supported on Win32 platform)
VIRTUAL void METHOD(SetFullscreenMode)(THIS_ const DisplayModeAttribs REF DisplayMode) PURE;