summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-05-20 06:13:41 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-05-20 06:13:41 +0000
commit64888e8097027b9becb6ab4def09b510d291cf64 (patch)
tree4acc60e9471121f06862a503fe717b8012617375 /Graphics/GraphicsEngine
parentUnified shader type defines for all backends (diff)
downloadDiligentCore-64888e8097027b9becb6ab4def09b510d291cf64.tar.gz
DiligentCore-64888e8097027b9becb6ab4def09b510d291cf64.zip
Improved latency handling in D3D11 and D3D12 (API 240061, fixed https://github.com/DiligentGraphics/DiligentEngine/issues/81)
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/SwapChainBase.hpp3
-rw-r--r--Graphics/GraphicsEngine/interface/APIInfo.h2
-rw-r--r--Graphics/GraphicsEngine/interface/GraphicsTypes.h4
-rw-r--r--Graphics/GraphicsEngine/interface/SwapChain.h25
4 files changed, 24 insertions, 10 deletions
diff --git a/Graphics/GraphicsEngine/include/SwapChainBase.hpp b/Graphics/GraphicsEngine/include/SwapChainBase.hpp
index 181826ac..4c0f685d 100644
--- a/Graphics/GraphicsEngine/include/SwapChainBase.hpp
+++ b/Graphics/GraphicsEngine/include/SwapChainBase.hpp
@@ -90,6 +90,9 @@ public:
return m_SwapChainDesc;
}
+ virtual void DILIGENT_CALL_TYPE SetMaximumFrameLatency(Uint32 MaxLatency) override
+ {}
+
protected:
bool Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFORM NewPreTransform, Int32 Dummy = 0 /*To be different from virtual function*/)
{
diff --git a/Graphics/GraphicsEngine/interface/APIInfo.h b/Graphics/GraphicsEngine/interface/APIInfo.h
index 0f2ec7ab..0274a2b2 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 240060
+#define DILIGENT_API_VERSION 240061
#include "../../../Primitives/interface/BasicTypes.h"
diff --git a/Graphics/GraphicsEngine/interface/GraphicsTypes.h b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
index 936da969..ecce27ba 100644
--- a/Graphics/GraphicsEngine/interface/GraphicsTypes.h
+++ b/Graphics/GraphicsEngine/interface/GraphicsTypes.h
@@ -1288,9 +1288,9 @@ struct SwapChainDesc
/// method.
SURFACE_TRANSFORM PreTransform DEFAULT_INITIALIZER(SURFACE_TRANSFORM_OPTIMAL);
- /// Number of buffers int the swap chain
+ /// The number of buffers in the swap chain
Uint32 BufferCount DEFAULT_INITIALIZER(2);
-
+
/// Default depth value, which is used as optimized depth clear value in D3D12
Float32 DefaultDepthValue DEFAULT_INITIALIZER(1.f);
diff --git a/Graphics/GraphicsEngine/interface/SwapChain.h b/Graphics/GraphicsEngine/interface/SwapChain.h
index d6ffa97e..75b4d4b3 100644
--- a/Graphics/GraphicsEngine/interface/SwapChain.h
+++ b/Graphics/GraphicsEngine/interface/SwapChain.h
@@ -88,6 +88,16 @@ DILIGENT_BEGIN_INTERFACE(ISwapChain, IObject)
/// Sets windowed mode (only supported on Win32 platform)
VIRTUAL void METHOD(SetWindowedMode)(THIS) PURE;
+
+ /// Sets the maximum number of frames that the swap chain is allowed to queue for rendering.
+
+ /// This value is only relevant for D3D11 and D3D12 backends and ignored for others.
+ /// By default it matches the number of buffers in the swap chain. For example, for a 2-buffer
+ /// swap chain, the CPU can enqueue frames 0 and 1, but Present command of frame 2
+ /// will block until frame 0 is presented. If in the example above the maximum frame latency is set
+ /// to 1, then Present command of frame 1 will block until Present of frame 0 is complete.
+ VIRTUAL void METHOD(SetMaximumFrameLatency)(THIS_
+ Uint32 MaxLatency) PURE;
/// Returns render target view of the current back buffer in the swap chain
@@ -115,13 +125,14 @@ DILIGENT_END_INTERFACE
// clang-format off
-# define ISwapChain_Present(This, ...) CALL_IFACE_METHOD(SwapChain, Present, This, __VA_ARGS__)
-# define ISwapChain_GetDesc(This) CALL_IFACE_METHOD(SwapChain, GetDesc, This)
-# define ISwapChain_Resize(This, ...) CALL_IFACE_METHOD(SwapChain, Resize, This, __VA_ARGS__)
-# define ISwapChain_SetFullscreenMode(This, ...) CALL_IFACE_METHOD(SwapChain, SetFullscreenMode, This, __VA_ARGS__)
-# define ISwapChain_SetWindowedMode(This) CALL_IFACE_METHOD(SwapChain, SetWindowedMode, This)
-# define ISwapChain_GetCurrentBackBufferRTV(This) CALL_IFACE_METHOD(SwapChain, GetCurrentBackBufferRTV, This)
-# define ISwapChain_GetDepthBufferDSV(This) CALL_IFACE_METHOD(SwapChain, GetDepthBufferDSV, This)
+# define ISwapChain_Present(This, ...) CALL_IFACE_METHOD(SwapChain, Present, This, __VA_ARGS__)
+# define ISwapChain_GetDesc(This) CALL_IFACE_METHOD(SwapChain, GetDesc, This)
+# define ISwapChain_Resize(This, ...) CALL_IFACE_METHOD(SwapChain, Resize, This, __VA_ARGS__)
+# define ISwapChain_SetFullscreenMode(This, ...) CALL_IFACE_METHOD(SwapChain, SetFullscreenMode, This, __VA_ARGS__)
+# define ISwapChain_SetWindowedMode(This) CALL_IFACE_METHOD(SwapChain, SetWindowedMode, This)
+# define ISwapChain_SetMaximumFrameLatency(This, ...) CALL_IFACE_METHOD(SwapChain, SetMaximumFrameLatency, This, __VA_ARGS__)
+# define ISwapChain_GetCurrentBackBufferRTV(This) CALL_IFACE_METHOD(SwapChain, GetCurrentBackBufferRTV, This)
+# define ISwapChain_GetDepthBufferDSV(This) CALL_IFACE_METHOD(SwapChain, GetDepthBufferDSV, This)
// clang-format on